Search the Community
Showing results for tags 'hmac sha1 oauth'.
-
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...
-
[solution SkinnyWhiteGuy] Hi, I have been trying to work with HMAC-SHA1 for oAuth, as it is the base requirement for generating the oAuth Signature. According to the definition http://en.wikipedia.org/wiki/Hash-based_message_authentication_code Definition (from RFC 2104) HMAC (K,m) = H ((K ^ opad) || H ((K ^ ipad) || m)) where H is a cryptographic hash function, K is a secret key padded to the right with extra zeros to the input block size of the hash function, or the hash of the original key if it's longer than that block size, m is the message to be authenticated, || denotes concatenation, ^ denotes exclusive or (XOR), opad is the outer padding (0x5c5c5c…5c5c, one-block-long hexadecimal constant), and ipad is the inner padding (0x363636…3636, one-block-long hexadecimal constant). Since this is XOR of two strings I have used _StringEncrypt = RC4 = XOR two strings. However, somewhere I am making a mistake and I getting a different result. Need Help. Regards #include <Crypt.au3> #include <String.au3> $message = 'the' $key = 'key' $key = key_fill($key) ConsoleWrite('Key = ' & $key & @CRLF) $opad = '0x'&_StringEncrypt(1, $key, padfill('5c', 64)) ConsoleWrite('Opad = ' & $opad & @CRLF) $ipad = '0x'&_StringEncrypt(1, $key, padfill('36', 64)) ConsoleWrite('Ipad = ' & $ipad & @CRLF) $val = _Crypt_HashData($opad & _Crypt_HashData($ipad & $message, $CALG_SHA1), $CALG_SHA1) ConsoleWrite('OutPut Hash = ' & StringLower($val) & @CRLF) ConsoleWrite(@CRLF & 'HMAC SHA1 from website http://caligatio.github.com/jsSHA/ ' & @CRLF _ & 'Input = the ' & @CRLF _ & 'Key = key ' & @CRLF _ & 'OutPut Hash = 0xe2bd5b5373d0602ec959cac3f83f5d1714744853' & @CRLF) Func key_fill($keyfill) If StringLen($keyfill) < 64 Then While StringLen($keyfill) < 64 $keyfill &= 0 WEnd Else $keyfill = _Crypt_HashData($keyfill, $CALG_SHA1) EndIf Return $keyfill EndFunc ;==>key_fill Func padfill($pad, $blocksize) Local $i = 1, $retpad While $i <= 64 $retpad &= $pad $i += 1 WEnd ConsoleWrite($retpad &@CRLF) Return $retpad EndFunc ;==>padfill The OutPut Key = key0000000000000000000000000000000000000000000000000000000000000 5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c Opad = 0x0B1BACB78CAE03D70B6993DC7F377E24B4C57CF4B51C5C2A875A71245C691C452FF81ED75B9AF81DB15C112E654AF8EA685F8B2F95CEA2B3D8FD6BE4680289B4DC589D2016184697A58E098608F80384BE7446FA95EE8B6AF7EEC332E051B021F10B49CF32110F3B9918FE704AA8C22A6C955F5A99370C184408185FD8982BAE 36363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636 Ipad = 0x159D405E7F0A5237C2810038FCBA216A4366FF99482CDD115D775BD0554F2A74457E227429511135CD511F6707A2BDD8C2FF3B2774FEAF59B1CB0258152204D66A475319B56793A82968090D19A0DE6FD9C2E7C52CBB759D7E6EC4231976A9363E99928F21EE2F8B31F101277CE935E7B0F62779126A528974208ABFF004060C OutPut Hash = 0x8aa82e26740e55c7185f04432d82f064bf41e442 HMAC SHA1 from website http://caligatio.github.com/jsSHA/ Input = the Key = key OutPut Hash = 0xe2bd5b5373d0602ec959cac3f83f5d1714744853