Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difference between demo outputs and local test outputs #68

Open
GoogleCodeExporter opened this issue Oct 28, 2015 · 2 comments
Open

Difference between demo outputs and local test outputs #68

GoogleCodeExporter opened this issue Oct 28, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link


Hello,

I have a problem, 

I would like to crypt with HMAC SHA1 algorithm the string "113004281321398000" 
with the key "Mj\{NTA=MTA(5874"

To do so I use AS3CRYPTO demo here crypto:hurlant:com/demo, I choose HMAC 
panel, sha1. Then I paste my key and the string data in text format, I choose 
base64 for output format.

It outputs [B]GJdYxXIlAwT1FdXtaVQIdZmfKJk=[/B]

But Under FLASH CS5 I write this code to crypt :

[CODE]
import com.hurlant.util.Base64;
import com.hurlant.util.Hex;
import com.hurlant.crypto.hash.HMAC;
import com.hurlant.crypto.Crypto;
import com.hurlant.crypto.hash.IHash;
import com.hurlant.crypto.hash.SHA1;

var key_str:String = 'Mj\{NTA=MTA(5874';
var str:String = '113004281321398000';

var key:ByteArray = Hex.toArray(Hex.fromString(key_str));
var pt:ByteArray = Hex.toArray(Hex.fromString(str));

var hmac:HMAC = Crypto.getHMAC('hmac-sha1');
//var hmac:HMAC = new HMAC(new SHA1());

var secret:ByteArray = hmac.compute(key, pt);
var result = Base64.encodeByteArray(secret);
//secret = Hex.fromArray(secret);
trace(result);

[/CODE]

And it outputs [B]HQLQpEclCPFaOp9tdPmKL0UiVLE=[/B]

This is confusing because the outputs are different between the demo and my 
test, I know that the right output is from the demo.

Do you know where is the problem?

Thanks



What version of the product are you using? On what operating system?
1.3, windows


Thanks


Original issue reported on code.google.com by alexandreaazzouz@gmail.com on 17 Nov 2011 at 10:09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant