Jump to content

hmac md5 - need some tips

Recommended Posts

How do I write this in autoit?

function md5_hmac($data, $key)
    if (strlen($key) > 64)
        $key = pack('H*', md5($key));
    $key  = str_pad($key, 64, chr(0x00));

    $k_ipad = $key ^ str_repeat(chr(0x36), 64);
    $k_opad = $key ^ str_repeat(chr(0x5c), 64);

    return md5($k_opad . pack('H*', md5($k_ipad . $data)));

the pack can be done like this

Func _packH($sInput)
    Local $sReply = ""
    For $xx = 1 To StringLen($sInput) Step 2
        $sReply &= Chr(Dec(StringMid($sInput, $xx, 2)))
    Return $sReply
EndFunc   ;==>_packH by Luigi

str_pad (don't know if I made some mistake)

Func str_pad($input, $PadLenght, $padChr = Chr(0x00))
    If Not IsNumber($PadLenght) Then SetError(1)
    If StringLen($input) < $PadLenght Then
        Local $out=$input, $c = $PadLenght - StringLen($input)
        For $qwer = 1 To $c
            $out &=$padChr
    Return $out


Func str_repeat($input, $multi)
    If Not IsNumber($multi) Then SetError(1)
    Local $out = ''
    For $x = 1 To $multi
        $out &= $input
    Return $out

chr 0x36 = 6 ?
chr 0x56 = \ ?

how can you exp a chr?? WTF

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there'sĀ InetReadĀ and WinHTTP, way better

Share this post

Link to post
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

  • Create New...