字符串的MD5的ActionScript返回不正确的结果时,一些十六进制的字符串的一部分(即" ABC \ XBF \ x4E") [英] MD5 of String in ActionScript returning incorrect results when some hex is part of the string( ie"abc\xBF\x4E")

查看:151
本文介绍了字符串的MD5的ActionScript返回不正确的结果时,一些十六进制的字符串的一部分(即" ABC \ XBF \ x4E")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想MD5 ActionScript中的字符串中使用是由Adobe创建的,是的as3corelib的一部分的MD5算法。 (HTTP://as3corelib.google$c$c.com/svn/trunk/src/com/adobe/crypto/MD5.as)。

I am trying to MD5 a string in ActionScript using the MD5 algorithm that was created by Adobe and is part of AS3corelib. (http://as3corelib.googlecode.com/svn/trunk/src/com/adobe/crypto/MD5.as).

我比较这在PHP中生成一个MD5,我知道是正确的。

I am comparing this to an MD5 created in php that I know is correct.

如果我创建使用的AS和PHP为发言权MD5s像ABCD1234,他们都相等,为的是可以预料的字符串。问题是,当我的字符串包含一些十六进制在里面,即ABCD \ X28 \ XBF \ x4E,从动作脚本MD5s和PHP返回不同的值。

If I create MD5s using AS and PHP for say a string like "abcd1234" they both are equal, as is to be expected. The problem is, when my string contains some hexadecimal in it ie "abcd\x28\xBF\x4E", the MD5s from ActionSCript and php return different value.

现在真是个奇怪的部分是,只要十六进制是一个数字的形式时,它是一个字符串,它的罚款,仍然匹配:

Now the really strange part is as long as the hexadecimal is in the form of a number when its a string its fine and still matches:

ABCD \ X28 \ X46将匹配来自AS的MD5和PHP的MD5值。  而 ABCD \ X28 \ XBF会产生不同的哈希值。

"abcd\x28\x46" will have matching values from AS's MD5 and php's MD5. While "abcd\x28\xBF" will yield different hashes.

任何人有什么想法?我已经彻底测试了PHP的MD5和我知道这是正确的,而动作不正确。我AP preciate的帮助,感谢您的阅读,我很抱歉,如果这是令人困惑的。我是小白,当谈到字符串编码,再presentation等。 谢谢, 德鲁秒。

Anyone have any ideas? I've tested the php MD5 thoroughly and I know it is correct and the ActionScript is incorrect. I appreciate the help, thanks for reading and I apologize if this was confusing. I'm a noob when it comes to string encoding, representation etc. Thanks, Drew S.

推荐答案

最有可能的,PHP和ActionScript使用不同的编码字符串;一种是可能使用的ISO-8859-1,而另一个使用UT​​F-8。

Most likely, PHP and ActionScript are using different encodings for strings; one is probably using ISO-8859-1 and the other is using UTF-8.

有关 ABCD \ X28 \ XBF ,值:

  • fcfebaeb81afe401c4b608dc684ad08f 根据ISO-8859-1
  • 47ef883a009ddbe01711ece0a0a8764e 下UTF-8
  • fcfebaeb81afe401c4b608dc684ad08f under ISO-8859-1
  • 47ef883a009ddbe01711ece0a0a8764e under UTF-8

和为 ABCD \ X28 \ XBF \ x4E (你的其他的例子),值:

And for abcd\x28\xBF\x4E (your other example), the values are:

  • ea382d63efca32d8d7861a314a6112e3 根据ISO-8859-1
  • dc11cdbaa05aa41640a821fb8e290eae 下UTF-8
  • ea382d63efca32d8d7861a314a6112e3 under ISO-8859-1
  • dc11cdbaa05aa41640a821fb8e290eae under UTF-8

这篇关于字符串的MD5的ActionScript返回不正确的结果时,一些十六进制的字符串的一部分(即" ABC \ XBF \ x4E")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆