我正在使用xcode,这是我的sha512方法:
-(NSString*) sha512:(NSString*)input
{
const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding];
NSData *data = [NSData dataWithBytes:cstr length:input.length];
uint8_t digest[CC_SHA512_DIGEST_LENGTH];
CC_SHA512(data.bytes, data.length, digest);
NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA512_DIGEST_LENGTH * 2];
for (int i = 0; i < CC_SHA512_DIGEST_LENGTH; i++) {
[output appendFormat:@"%02x", digest[i]];
}
return output;
}
Run Code Online (Sandbox Code Playgroud)
当我尝试通过输入"测试",则返回:"ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff"它匹配其他SHA512哈希工具(包括我的Java程序和"http://hash.online-convert.com/sha512-generator").
但是,当我输入像"é"这样的非ascii字符时,它会返回与我所有其他sha512工具不同的东西.对于输入"é",我的方法返回:"60313f8521d3016916d876f7ad11cf42a30dfd4ff9bc557f1e2f90e0d37c56b76ab5e42c8a16db20c18086b0d769c08542429c262cc21ee4fba02bfc689a4797"当其他工具(包括一次我的Java程序和"http://hash.online-convert.com/sha512-generator")返回"9e2ad28633f24451bd4f3c1cb20586a21a44c3aeedbdc01b9cc8fa72917ea7bd689c82b8bf1fef89b911cf8cc46fa2c1ccc10087b2094fd4d3350ecd88526a2c".
我错过了什么吗?有关于此的任何想法?谢谢!
我正在使用grails2.3.7和hibernate4.但是,默认的数据库迁移插件不能与hibernate4一起使用.有没有其他插件可以做同样的事情,但支持hibernate4?
谢谢.
我有一个包含iframe的页面,我只想跟踪iframe的历史记录.我试着像这样使用历史对象:
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function checkFrameHistory() {
alert(window.frames["test2"].history.length);
}
function checkThisHistory() {
alert(history.length);
}
</script>
</head>
<body>
<iframe name="test2" src="test2.html"></iframe>
<div>
<input type="button" onclick="checkFrameHistory()" value="Frame history"/>
<input type="button" onclick="checkThisHistory()" value="This history"/>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
test2.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function checkMyHistory() {
alert(history.length);
}
</script>
</head>
<body>
<div>
Test2
</div>
<div>
<input type="button" onclick="checkMyHistory()" value="My history"/>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
但它实际上给了我包括父窗口的历史记录.
例如,我去了主窗口的另一个站点,然后回到我的iframe测试站点.双方window.frames["test2"].history.length并history.length仍然由2增加长度给了我同样的计数.
我做错了吗?有没有办法只跟踪iframe历史记录?
在playframework 1.x中,session只是模板中的一个隐含对象,但它似乎已经在playframework 2.0中消失了.我有办法在模板中使用会话对象吗?
谢谢.
我正在尝试将数据直接加载到UIWebView:
[webView loadData:data MIMEType:@"text/html" textEncodingName:@"utf-8"
baseURL:nil];
Run Code Online (Sandbox Code Playgroud)
数据是一些html字符串,其中包含一些外部链接。我试图基于UIWebView属性启用后退和前进按钮:
self.forwardBtn.enabled = self.webView.canGoForward;
self.backBtn.enabled = self.webView.canGoBack;
Run Code Online (Sandbox Code Playgroud)
但是,即使在初始加载后我在Web视图中单击了不同的链接后,webView.canGoForward和webView.canGoBack也总是返回NO。
有什么想法吗?
这是我的路线文件中的一行:
GET /detail controllers.Message.detail(type: String, text: String, page: Integer ?= 0)
Run Code Online (Sandbox Code Playgroud)
当我尝试加载页面时,它突出显示了这一行,并声明"标识符已预期,但'类型'已找到.".现在,如果我将参数从更改type: String为newType: String,则页面正常加载.
这个词有type什么问题?路由文件中是否有保留字?
public class PlayScreen implements Screen{
Stage stage;
LabelStyle style;
BitmapFont font;
TextureAtlas backbuttonatlas;
TextButtonStyle backbuttonstyle;
TextButton backbutton;
Skin backskin;
SpriteBatch batch;
Texture pibe;
Sprite sprite;
Vector2 position;
Game game;
Texture texture;
public PlayScreen(Game game){
this.game=game;
}
@Override
public void render(float delta) {
stage=new Stage();
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
if(Gdx.input.isKeyPressed(Keys.W))
{
position.x+=5f;
}
if(Gdx.input.isKeyPressed(Keys.A))
{
position.y-=5f;
}
if(Gdx.input.isKeyPressed(Keys.S))
{
position.x-=5f;
}
if(Gdx.input.isKeyPressed(Keys.D))
{
position.y+=5f;
}
if(Gdx.input.isTouched()==true)
{
if(Gdx.input.getY()>Gdx.graphics.getHeight()/2)
{
position.x-=5;
}
if(Gdx.input.getY()<Gdx.graphics.getHeight()/2)
{
position.x+=5;
}
if(Gdx.input.getX()>Gdx.graphics.getWidth()/2)
{
position.y+=5;
}
if(Gdx.input.getX()<Gdx.graphics.getWidth()/2) …Run Code Online (Sandbox Code Playgroud) java ×3
ios ×2
objective-c ×2
android ×1
cocoa-touch ×1
database ×1
grails ×1
grails-2.3 ×1
grails-orm ×1
hash ×1
hibernate ×1
html ×1
html5 ×1
iframe ×1
javascript ×1
libgdx ×1
sha2 ×1
sha512 ×1
uiwebview ×1