<commit_before>// Challenge 37 - Break SRP with a zero key
// http://cryptopals.com/sets/5/challenges/37

package cryptopals

import "math/big"

type challenge37 struct {
}

func (challenge37) Client(net Network) bool {
	A := big.NewInt(0)

	net.Write(A)
	net.Read()
	net.Read()

	S := A
	K := sha256Digest(S.Bytes())

	mac := hmacSHA256(K, S.Bytes())
	net.Write(mac)

	return net.Read().(bool)
}

func (challenge37) Server(params srpParams, info srpClientInfo, net Network) bool {
	return challenge36{}.Server(params, info, net)
}<commit_msg>Fix client to hmac salt instead of secret<commit_after>// Challenge 37 - Break SRP with a zero key
// http://cryptopals.com/sets/5/challenges/37

package cryptopals

import "math/big"

type challenge37 struct {
}

func (challenge37) Client(net Network) bool {
	A := big.NewInt(0)
	net.Write(A)

	s := readBytes(net)
	net.Read()

	S := A
	K := sha256Digest(S.Bytes())

	mac := hmacSHA256(K, s)
	net.Write(mac)

	return net.Read().(bool)
}

func (challenge37) Server(params srpParams, info srpClientInfo, net Network) bool {
	return challenge36{}.Server(params, info, net)
}
{'fraction_non_alphanumeric': 0.1452914798206278, 'fraction_numerical': 0.03587443946188341, 'mean_word_length': 4.214953271028038, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6090188', 'n_tokens_mistral': 454, 'n_tokens_neox': 408, 'n_words': 108}