The expected output is: 1da1b8f5901f02b0d95532acbf9c0db9f7b427ee Actual output: 85c1891c3a7ba16d0582126ee4849f250fc95c45
I've been at this for ages, can anybody point me in the right direction to get this to work? or is there a hmac function already written in vbscript? I checked all over the net but couldn't find a vbscript implementation
I'm not sure what you mean by "make-shift", keyed-Hash Message Authentication Code (HMAC), is used to ensure data integrity when a message is sent to part of the system. I don't usually do much in vbscript so I'm having trouble implementing the HMAC side of things. The hash is taken care of by the sha-1 code I have linked to.
There's an interpretation problem in your implementation
in the line
hmac = sha1(strOpad & sha1(strIpad & text))
when you calculate sha1( strIpad & text ), your function sha1 returns a 40 character string, BUT the RFC says you must use the 20 bytes (160 bit) value of the sha1, not the hex representation of it.
I haven't seen your implementation of the sha1 hash, but i suppose your are using a byte[20] array or a long[5] array to hold the 160 bits of sha1, and in the last step, encoding this information to hex so you get 40 chars.
So, don't encode to hex. Just return a byte array and use that array into your hmac function.