MCPcopy Index your code
hub / github.com/XTLS/Go / pHash

Function pHash

prf.go:27–45  ·  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

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

Callers 2

prf10Function · 0.85
prf12Function · 0.85

Calls 3

ResetMethod · 0.80
WriteMethod · 0.45
SumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…