string srcs="06DA43DD91584F82BF2EB9D7F5BAD7"; uchar src[],dst[],key[],temp[]; StringToCharArray(srcs,src); ArrayResize(src,ArraySize(src)-1); int k=CryptEncode(CRYPT_HASH_SHA1,src,key,dst); string hash=""; for(int i=0;i<k;i++) { hash+=StringFormat("%.2x",dst[i]); } Print(hash);mql5 string are null terminated.
Pedro:
Hello,
I am curious about what the CryptEncode function does.
Does it concatenate the Source String with the Key before hashing?
If it does what is the order of the concatenation? The source or the key will come first?
It is simply not documented.
What is not documented ? All CryptEncode methods are well know and documented algorithms.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello friends,
In my code I need to encode a key into SHA1 hash but as I tried so many times the generated hash is not what it should be for the same src[].
Here is my code:
From the code below the generated hash is: "386c7d21720cc304f8d97435de3080fbbdf3c7b1"
While it should be : "f58dd8d6effd71050ee5979960ca18c28eb3fd54"
Am I Missing Something??