Skip to content

Commit

Permalink
Use pad(to:) when padding g
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Oct 30, 2024
1 parent 89a3eda commit 9468111
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Sources/SRP/srp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ public struct SRP<H: HashFunction> {
hashSharedSecret: [UInt8]
) -> [UInt8] {
// M = H(H(N)^ H(g)) | H(username) | salt | client key | server key | H(shared secret))
let g = SRPKey(configuration.g, padding: configuration.sizeN)
let N_xor_g = [UInt8](H.hash(data: configuration.N.bytes)) ^ [UInt8](H.hash(data: g.bytes))
let N_xor_g = [UInt8](H.hash(data: configuration.N.bytes)) ^ [UInt8](H.hash(data: configuration.g.bytes.pad(to: configuration.sizeN)))
let hashUser = H.hash(data: [UInt8](username.utf8))
let M1 = [UInt8](N_xor_g) + hashUser + salt
let M2 = clientPublicKey.bytes + serverPublicKey.bytes + hashSharedSecret
Expand Down

0 comments on commit 9468111

Please sign in to comment.