Hmm. The posting above went a bit wrong - I guess I'm posting Python code rather than Javascript.
Here is the garbled bit, not marked as code to hopefully keep the forum happy
def colin_hotp_token(secret, intervals_no):
# Key is a 10 byte array
key = base64.b32decode(secret, True)
# Python debug : print the key as bytes #print "KEY",[ord(x) for x in key]
#keybytes=[0, 68, 50, 20, 199, 66, 64, 17, 12, 133]
# msg is 8 bytes long - number with last byte = least significant
msg = struct.pack(">Q", intervals_no) #msgbytes=[0, 0, 0, 0, 0, 0, 0, 1]
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hmm. The posting above went a bit wrong - I guess I'm posting Python code rather than Javascript.
Here is the garbled bit, not marked as code to hopefully keep the forum happy
def colin_hotp_token(secret, intervals_no):
# Key is a 10 byte array
key = base64.b32decode(secret, True)
# Python debug : print the key as bytes
#print "KEY",[ord(x) for x in key]
#keybytes=[0, 68, 50, 20, 199, 66, 64, 17, 12, 133]
# msg is 8 bytes long - number with last byte = least significant
msg = struct.pack(">Q", intervals_no)
#msgbytes=[0, 0, 0, 0, 0, 0, 0, 1]