Last active
October 5, 2022 05:59
-
-
Save pressure679/b14d42fa839ccb743323 to your computer and use it in GitHub Desktop.
ptk generator (CCMP)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func CustomPRF512(key, a, ssid string, b []byte) []byte { | |
var ptk []byte | |
var buff bytes.Buffer | |
nullbyte := []byte{0} | |
for i := 0; i < 4; i++ { | |
passwordstr := "Pairwise key expansion" + string(nullbyte) + string(b) + string(i) | |
password := []byte(passwordstr) | |
// hmacsha1 = hmac.new(key,A+chr(0x00)+B+chr(i),sha) | |
//salt := []byte(pmk) | |
//ptk1 = HashPassword(salt, password, 20) | |
// hmacsha1 := hmac.New(sha1.New, password) | |
mysha1 := sha1.New() | |
mysha1.Write([]byte(key)) | |
ptk1 := HashPassword(password, []byte(ssid), 4096, 16) | |
buff.Write(ptk1) | |
} | |
ptk = buff.Bytes() | |
return ptk | |
} | |
func HashPassword(password, salt []byte, iter, keylen int) []byte { | |
defer clear(password) | |
return pbkdf2.Key(password, salt, 4096, 16, sha1.New) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment