CNG (Cryptography API: Next Generation)

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
haichen
Posts: 631
Joined: 09 Feb 2014, 08:24

Re: CNG (Cryptography API: Next Generation)

09 Oct 2022, 10:55

I am trying to recreate the Google Authenticator.
The core is a hmac sha-1 hash. Unfortunately these pages here always show different results than

https://github.com/jNizM/AHK_CNG/blob/master/src/v1.1_deprecated/functions/bcrypt_sha1_hmac.ahk

Since I think jNizM results are correct, I'm probably missing something. Maybe someone can help me.


https://cable.ayra.ch/totp/
https://medium.com/concerning-pharo/the-code-behind-google-authenticator-9c59c606a572

Here is the example from the former site:

Code: Select all

a:="HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ"     ;Base32 encoded
b:="3DC6CAA4824A6D288767B2331E20B43166CB85D9" ;as hex decoded
secret:=0000000002EFD5B8

MsgBox % bcrypt_sha1_hmac(a,secret) ; =>550c552709874a9fdd11f4079ed203e9a4d99d97
MsgBox % bcrypt_sha1_hmac(b,secret) ;=>bee26e59eee4122ff0d50b3d085e53c90e758c25
but it schould 7F43D4DBEC5836A89EB12470B1F47058E0A982D7
Maybe someone can help me.
mitchneal
Posts: 10
Joined: 31 Dec 2020, 20:24

Re: CNG (Cryptography API: Next Generation)

10 Oct 2023, 21:17

https://i.imgur.com/OLsAdKi.png
CNG seems to not work properly in Windows 11

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: Google [Bot] and 178 guests