我尝试用盐获得base64编码的md5哈希密码(盐是md5,我得到base64编码)
var pass = "hello";
var salt=haxe.crypto.Base64.encode(haxe.crypto.Md5.make(haxe.io.Bytes.ofString("hello")));
trace(haxe.crypto.Base64.encode(haxe.crypto.Md5.make(haxe.io.Bytes.ofString(haxe.crypto.Base64.decode(salt).toString() + haxe.crypto.Md5.make(haxe.io.Bytes.ofString(pass)).toString()))));
on neko它写:
YWsigXuA7tn2XDqjjNKQVA==
but flash give me:
9Hpay/lKyMcm/s8qpPRczQ==
为什么他们是不同的?我怎么解决这个问题呢?
这就解决问题了
var buf:Bytes = Bytes.ofString("aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbb"); //create Bytes 32 long
buf.blit(0, Base64.decode(salt), 0, 16); //set first 16
buf.blit(16, Md5.make(Bytes.ofString(pass)), 0, 16); //set second 16
var password:String = Base64.encode(Md5.make(buf));//md5(salt+pass)