将 SHA512 Javascript 实现移植到 Actionscript
我想知道是否有人可以帮助我将 Javascript 中的 SHA-512 实现移植到 Actionscript。 由于 Javascript 和 Actionscript 具有相同的起源,我认为对于习惯 Actionscript 的人来说移植它会很容易。
javascript 中 sha512 的代码可以在这里找到:
http://pajhome.org.uk /crypt/md5/sha512.html
谢谢。
I am wondering if anyone can help me in porting a SHA-512 implemention in Javascript to Actionscript. Since both Javascript and Actionscript share the same origin, I think porting it will be easy for people who are used to Actionscript.
The code for sha512 in javascript can be found here:
http://pajhome.org.uk/crypt/md5/sha512.html
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我移植的代码。 代码分为两个文件 Int64.as 和 Sha512.as,它们都属于 com.crypto 包。
com/crypto/Int64.as
com/crypto/Sha512.as
抱歉,我找不到合适的位置来上传它们。
Here is the code ported by me. The code is separated between two files Int64.as and Sha512.as, both of them belong to the com.crypto package.
com/crypto/Int64.as
com/crypto/Sha512.as
Sorry, I could not find a proper place to upload them.
我无法对上面的内容发表评论(应该是这样),但是由于 Actionscript 在将空字符附加到字符串时的想象力行为(事实并非如此),使用此代码的某些签名会出现错误。
为了对我正在使用的十六进制编码 hmac 进行快速而肮脏的修复,我更改了 hex_hmac_sha512 函数(仅用于它调用的编码)并添加了 binb2hex 函数,如下所示:
I am not able to post a comment on the above (where this should be), but there is an error with some signatures using this code due to Actionscript's imaginative behaviour when appending the null character to a string (it doesn't).
For a quick and dirty fix to the hex encoded hmac which is what I am using, I changed the hex_hmac_sha512 function (just for the encoding it calls) and added a binb2hex function as follows: