Skip to content

Commit 749f582

Browse files
committed
HORRIBLE KLUDGE, using sha256 for sha224. Fix before we leave sandbox.
1 parent 93ef991 commit 749f582

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/org/python/modules/_hashlib.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public class _hashlib implements ClassDictInit {
3030
/** A mapping of Python algorithm names to MessageDigest names. */
3131
private static final Map<String, String> algorithmMap = new HashMap<String, String>() {{
3232
put("sha1", "sha-1");
33+
put("sha224", "sha-224");
3334
put("sha256", "sha-256");
3435
put("sha384", "sha-384");
3536
put("sha512", "sha-512");
@@ -75,6 +76,16 @@ public static PyObject openssl_sha1(PyObject obj) {
7576
return new$("sha1", obj);
7677
}
7778

79+
public static PyObject openssl_sha224() {
80+
return openssl_sha224(null);
81+
}
82+
83+
public static PyObject openssl_sha224(PyObject obj) {
84+
//FIXME: WRONG!
85+
return new$("sha256", obj);
86+
//return new$("sha224", obj);
87+
}
88+
7889
public static PyObject openssl_sha256() {
7990
return openssl_sha256(null);
8091
}
@@ -118,6 +129,7 @@ public static class Hash extends PyObject {
118129
private static final Map<String, Integer> blockSizes = new HashMap<String, Integer>() {{
119130
put("md5", 64);
120131
put("sha-1", 64);
132+
put("sha-224", 64);
121133
put("sha-256", 64);
122134
put("sha-384", 128);
123135
put("sha-512", 128);

0 commit comments

Comments
 (0)