Jump to content

Autoit Hash-based message authentication code request


Recommended Posts

Hello, 

Firstly thank you that you are whatching this post....I am in a big trouble....i am trying to acces my ballance for crytopia acount using their api but i dont understend their encrypting procedures.They have published a small script written in 7 languages that can read the ballance...i just dont know how to convert it to autoit

Here are the scripts link

https://www.cryptopia.co.nz/Forum/Thread/262

 

And here is the documentation of what must include the post request

https://www.cryptopia.co.nz/Forum/Thread/256

Pleasee if someone could re-write that script for me because i just cant figure out how to do it..... I want to get my balance only and i really need your help...

Edited by JLogan3o13
Link to comment
Share on other sites

Hello guys ....i need to convert this line of PHP into autoit...i need a function to calculate Hash-based message authentication code ...basically i need this line of code to work on autoit (Is a php code)

$hmacsignature =hash_hmac("sha256", $signature, $key);

Thank you verry much....i really need it ...

Link to comment
Share on other sites

On 02.11.2012 at 11:02 PM, jchd said:

Some poin

On 03.11.2012 at 6:01 PM, DeltaRocked said:

Hi SkinnyWhiteGuy,

 

thanks. even I am through with the implementation. as I am at home , will be updating the code on Monday.

 

Rgds

 

On 03.11.2012 at 2:10 PM, SkinnyWhiteGuy said:

I was digging around some of my old code, and found this. Cleaned it up a little, and ensured it worked again.

 

I used Call on these, so with one HMAC function, you could use different hashing algorithms. Course, you'll have to modify the BlockSize for some hashing functions, but that's easily made an optional parameter and passed in for the larger block sizes of some hashing functions. It's also just as easy to remove the calls for the actual hash functions, if that's what you want.

 

 

#include <Crypt.au3>

Func sha1($message)
    Return _Crypt_HashData($message, $CALG_SHA1)
EndFunc

Func md5($message)
    Return _Crypt_HashData($message, $CALG_MD5)
EndFunc

Func hmac($key, $message, $hash="md5")
    Local $blocksize = 64
    Local $a_opad[$blocksize], $a_ipad[$blocksize]
    Local Const $oconst = 0x5C, $iconst = 0x36
    Local $opad = Binary(''), $ipad = Binary('')
    $key = Binary($key)
    If BinaryLen($key) > $blocksize Then $key = Call($hash, $key)
    For $i = 1 To BinaryLen($key)
        $a_ipad[$i-1] = Number(BinaryMid($key, $i, 1))
        $a_opad[$i-1] = Number(BinaryMid($key, $i, 1))
    Next
    For $i = 0 To $blocksize - 1
        $a_opad[$i] = BitXOR($a_opad[$i], $oconst)
        $a_ipad[$i] = BitXOR($a_ipad[$i], $iconst)
    Next
    For $i = 0 To $blocksize - 1
        $ipad &= Binary('0x' & Hex($a_ipad[$i],2))
        $opad &= Binary('0x' & Hex($a_opad[$i],2))
    Next
    Return Call($hash, $opad & Call($hash, $ipad & Binary($message)))
EndFunc

ConsoleWrite(hmac("key", "the", "sha1") & @CRLF)

 

Edit: Firefox ate my post, had to fix...

 

On 02.11.2012 at 11:02 PM, jchd said:

Some points for you to look at:

o) RC4 ≠ XOR

o) You seem to be confusing operation on strings and binary data. Look at you filled key: it should be a binary conatining the binary for 'key' appended with binary zeroes, not the character 0. Same for '5C' and '36'.

 

Once you change your code to perform on all binary data, I bet mud will clear a bit.

ts for you to look at:

o) RC4 ≠ XOR

o) You seem to be confusing operation on strings and binary data. Look at you filled key: it should be a binary conatining the binary for 'key' appended with binary zeroes, not the character 0. Same for '5C' and '36'.

 

Once you change your code to perform on all binary data, I bet mud will clear a bit.

GUYS I NEED YOUR HELP I  dont know how to convert this line of code from php to autoit I know that you are the only one who can help me

$hmacsignature =hash_hmac("sha256", $signature, base64_decode( $API_SECRET ));

Link to comment
Share on other sites

You've posted this question at least 3 times now in 3 different threads, stop already and stick to one thread.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

@cezarlacatus As has been mentioned, keep it to one thread.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Why does that thread not work for you? You state "I can't use it", what does that mean? What did you try and what did not work for you? Please be aware that this forum is dedicated to helping people improve their own scripts; it is not a place where you put in a request and someone does all the work for you. If you're encountering issues you need to:

  • Explain in detail what you have tried, and what is not working.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Developers

@cezarlacatus,

You are really pushing it around here when I see your brief history in our forums and finding an PM with a question from you.
I seriously advice you to read those forum rules we have around here before we feel the need to stop you impatience forcefully.
Welcome by the way. ;) 

Jos
 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

26 minutes ago, Earthshine said:

I seriously thought this was the answer he sought. The code in that post specifically.

 

Yes that encrypts data with md5.I need to encrypt data with sha256 and a password or something like that.I found a post but their scripts are using sha1 or anithing else but they are the base structure...i understend nothing from them

 

 

Link to comment
Share on other sites

41 minutes ago, Jos said:

@cezarlacatus,

You are really pushing it around here when I see your brief history in our forums and finding an PM with a question from you.
I seriously advice you to read those forum rules we have around here before we feel the need to stop you impatience forcefully.
Welcome by the way. ;) 

Jos
 

I am really sorry i wanted to lock my previous post and re-start a thread with the main problem ...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...