main
Raw Download raw file
 1package shared
 2
 3const (
 4	// Constants for the SHA-1 hash function.
 5	K0 = 0x5A827999
 6	K1 = 0x6ED9EBA1
 7	K2 = 0x8F1BBCDC
 8	K3 = 0xCA62C1D6
 9
10	// Initial values for the buffer variables: h0, h1, h2, h3, h4.
11	Init0 = 0x67452301
12	Init1 = 0xEFCDAB89
13	Init2 = 0x98BADCFE
14	Init3 = 0x10325476
15	Init4 = 0xC3D2E1F0
16
17	// Initial values for the temporary variables (ihvtmp0, ihvtmp1, ihvtmp2, ihvtmp3, ihvtmp4) during the SHA recompression step.
18	InitTmp0 = 0xD5
19	InitTmp1 = 0x394
20	InitTmp2 = 0x8152A8
21	InitTmp3 = 0x0
22	InitTmp4 = 0xA7ECE0
23
24	// SHA1 contains 2 buffers, each based off 5 32-bit words.
25	WordBuffers = 5
26
27	// The output of SHA1 is 20 bytes (160 bits).
28	Size = 20
29
30	// Rounds represents the number of steps required to process each chunk.
31	Rounds = 80
32
33	// SHA1 processes the input data in chunks. Each chunk contains 64 bytes.
34	Chunk = 64
35
36	// The number of pre-step compression state to store.
37	// Currently there are 3 pre-step compression states required: 0, 58, 65.
38	PreStepState = 3
39
40	Magic         = "shacd\x01"
41	MarshaledSize = len(Magic) + 5*4 + Chunk + 8
42)