MCPcopy
hub / github.com/XTLS/REALITY / pHash

Function pHash

prf.go:31–49  ·  view source on GitHub ↗

pHash implements the P_hash function, as defined in RFC 4346, Section 5.

(result, secret, seed []byte, hash func() hash.Hash)

Source from the content-addressed store, hash-verified

29
30// pHash implements the P_hash function, as defined in RFC 4346, Section 5.
31func pHash(result, secret, seed []byte, hash func() hash.Hash) {
32 h := hmac.New(hash, secret)
33 h.Write(seed)
34 a := h.Sum(nil)
35
36 j := 0
37 for j < len(result) {
38 h.Reset()
39 h.Write(a)
40 h.Write(seed)
41 b := h.Sum(nil)
42 copy(result[j:], b)
43 j += len(b)
44
45 h.Reset()
46 h.Write(a)
47 a = h.Sum(nil)
48 }
49}
50
51// prf10 implements the TLS 1.0 pseudo-random function, as defined in RFC 2246, Section 5.
52func prf10(secret []byte, label string, seed []byte, keyLen int) []byte {

Callers 1

prf10Function · 0.70

Calls 3

ResetMethod · 0.80
WriteMethod · 0.65
SumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…