MCPcopy Index your code
hub / github.com/python/cpython / test_hmac_sha1

Method test_hmac_sha1

Lib/test/test_socket.py:7119–7130  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7117 self.assertEqual(op.recv(512), expected)
7118
7119 def test_hmac_sha1(self):
7120 # gh-109396: In FIPS mode, Linux 6.5 requires a key
7121 # of at least 112 bits. Use a key of 152 bits.
7122 key = b"Python loves AF_ALG"
7123 data = b"what do ya want for nothing?"
7124 expected = bytes.fromhex("193dbb43c6297b47ea6277ec0ce67119a3f3aa66")
7125 with self.create_alg('hash', 'hmac(sha1)') as algo:
7126 algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY, key)
7127 op, _ = algo.accept()
7128 with op:
7129 op.sendall(data)
7130 self.assertEqual(op.recv(512), expected)
7131
7132 # Although it should work with 3.19 and newer the test blocks on
7133 # Ubuntu 15.10 with Kernel 4.2.0-19.

Callers

nothing calls this directly

Calls 6

create_algMethod · 0.95
setsockoptMethod · 0.45
acceptMethod · 0.45
sendallMethod · 0.45
assertEqualMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected