Mercurial Hosting > luan
diff src/luan/modules/url/LuanUrl.java @ 1649:f7e2df85fc0a
add String.digest_message
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2022 16:07:01 -0600 |
parents | 0160650180bc |
children | 83780735ad9c |
line wrap: on
line diff
--- a/src/luan/modules/url/LuanUrl.java Mon Mar 28 18:00:12 2022 +0200 +++ b/src/luan/modules/url/LuanUrl.java Tue Mar 29 16:07:01 2022 -0600 @@ -25,6 +25,7 @@ import luan.LuanJavaFunction; import luan.LuanException; import luan.modules.IoLuan; +import luan.modules.StringLuan; import luan.modules.Utils; @@ -379,15 +380,11 @@ return path; } - // retarded java api lacks this public static String md5(String s) { try { - byte[] md5 = MessageDigest.getInstance("MD5").digest(s.getBytes()); - StringBuffer sb = new StringBuffer(); - for( byte b : md5 ) { - sb.append( String.format("%02x",b) ); - } - return sb.toString(); + return StringLuan.digest_message("MD5",s); + } catch(LuanException e) { + throw new RuntimeException(e); } catch(NoSuchAlgorithmException e) { throw new RuntimeException(e); }