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

Method test_sha256

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

Source from the content-addressed store, hash-verified

7100 # at least on ppc64le architecture
7101 @support.requires_linux_version(4, 5)
7102 def test_sha256(self):
7103 expected = bytes.fromhex("ba7816bf8f01cfea414140de5dae2223b00361a396"
7104 "177a9cb410ff61f20015ad")
7105 with self.create_alg('hash', 'sha256') as algo:
7106 op, _ = algo.accept()
7107 with op:
7108 op.sendall(b"abc")
7109 self.assertEqual(op.recv(512), expected)
7110
7111 op, _ = algo.accept()
7112 with op:
7113 op.send(b'a', socket.MSG_MORE)
7114 op.send(b'b', socket.MSG_MORE)
7115 op.send(b'c', socket.MSG_MORE)
7116 op.send(b'')
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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected