9 {1,1,1,224,224,224,256,256,256,384,384,384,512,512,512};
11 MODULE = Digest::SHA PACKAGE = Digest::SHA
44 shawrite(bitstr, bitcnt, s)
45 unsigned char * bitstr
53 Digest::SHA::sha1_hex = 1
54 Digest::SHA::sha1_base64 = 2
55 Digest::SHA::sha224 = 3
56 Digest::SHA::sha224_hex = 4
57 Digest::SHA::sha224_base64 = 5
58 Digest::SHA::sha256 = 6
59 Digest::SHA::sha256_hex = 7
60 Digest::SHA::sha256_base64 = 8
61 Digest::SHA::sha384 = 9
62 Digest::SHA::sha384_hex = 10
63 Digest::SHA::sha384_base64 = 11
64 Digest::SHA::sha512 = 12
65 Digest::SHA::sha512_hex = 13
66 Digest::SHA::sha512_base64 = 14
74 if ((state = shaopen(ix2alg[ix])) == NULL)
76 for (i = 0; i < items; i++) {
77 data = (unsigned char *) (SvPV(ST(i), len));
78 shawrite(data, len << 3, state);
83 result = (char *) shadigest(state);
84 len = shadsize(state);
87 result = shahex(state);
89 result = shabase64(state);
90 ST(0) = sv_2mortal(newSVpv(result, len));
97 Digest::SHA::hmac_sha1 = 0
98 Digest::SHA::hmac_sha1_hex = 1
99 Digest::SHA::hmac_sha1_base64 = 2
100 Digest::SHA::hmac_sha224 = 3
101 Digest::SHA::hmac_sha224_hex = 4
102 Digest::SHA::hmac_sha224_base64 = 5
103 Digest::SHA::hmac_sha256 = 6
104 Digest::SHA::hmac_sha256_hex = 7
105 Digest::SHA::hmac_sha256_base64 = 8
106 Digest::SHA::hmac_sha384 = 9
107 Digest::SHA::hmac_sha384_hex = 10
108 Digest::SHA::hmac_sha384_base64 = 11
109 Digest::SHA::hmac_sha512 = 12
110 Digest::SHA::hmac_sha512_hex = 13
111 Digest::SHA::hmac_sha512_base64 = 14
120 key = (unsigned char *) (SvPV(ST(items-1), len));
121 if ((state = hmacopen(ix2alg[ix], key, len)) == NULL)
123 for (i = 0; i < items - 1; i++) {
124 data = (unsigned char *) (SvPV(ST(i), len));
125 hmacwrite(data, len << 3, state);
130 result = (char *) hmacdigest(state);
131 len = shadsize(state->osha);
133 else if (ix % 3 == 1)
134 result = hmachex(state);
136 result = hmacbase64(state);
137 ST(0) = sv_2mortal(newSVpv(result, len));
145 Digest::SHA::hashsize = 0
146 Digest::SHA::algorithm = 1
151 state = INT2PTR(SHA *, SvIV(SvRV(SvRV(self))));
152 result = shadsize(state) << 3;
153 if (ix == 1 && result == 160)
155 ST(0) = sv_2mortal(newSViv(result));
167 state = INT2PTR(SHA *, SvIV(SvRV(SvRV(self))));
168 for (i = 1; i < items; i++) {
169 data = (unsigned char *) (SvPV(ST(i), len));
170 shawrite(data, len << 3, state);
178 Digest::SHA::digest = 0
179 Digest::SHA::Hexdigest = 1
180 Digest::SHA::B64digest = 2
186 state = INT2PTR(SHA *, SvIV(SvRV(SvRV(self))));
190 result = (char *) shadigest(state);
191 len = shadsize(state);
194 result = shahex(state);
196 result = shabase64(state);
197 ST(0) = sv_2mortal(newSVpv(result, len));