This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new 488ec56  [OPENMEETINGS-2157] MD5 is restored for asterisk
488ec56 is described below

commit 488ec563d616d31eddb3d806891e3170e401f685
Author: Maxim Solodovnik <[email protected]>
AuthorDate: Sat Dec 21 10:27:23 2019 +0700

    [OPENMEETINGS-2157] MD5 is restored for asterisk
---
 .../apache/openmeetings/db/entity/user/User.java   |  2 +-
 .../java/org/apache/openmeetings/db/util/MD5.java  | 37 ++++++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/User.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/User.java
index f293280..7a96d79 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/User.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/user/User.java
@@ -64,8 +64,8 @@ import org.apache.openmeetings.db.dao.label.LabelDao;
 import org.apache.openmeetings.db.entity.HistoricalEntity;
 import org.apache.openmeetings.db.entity.label.OmLanguage;
 import org.apache.openmeetings.db.entity.server.Sessiondata;
+import org.apache.openmeetings.db.util.MD5;
 import org.apache.openmeetings.util.crypt.CryptProvider;
-import org.apache.openmeetings.util.crypt.MD5;
 import org.apache.wicket.util.string.Strings;
 import org.simpleframework.xml.Element;
 import org.simpleframework.xml.ElementList;
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/MD5.java 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/MD5.java
new file mode 100644
index 0000000..cdb6135
--- /dev/null
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/util/MD5.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.db.util;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import org.apache.commons.codec.binary.Hex;
+
+public class MD5 {
+       private MD5() {}
+
+       public static String checksum(String data) throws 
NoSuchAlgorithmException {
+               MessageDigest md5 = MessageDigest.getInstance("MD5");
+               byte[] b = data == null ? new byte[0] : data.getBytes(UTF_8);
+               md5.update(b, 0, b.length);
+               return Hex.encodeHexString(md5.digest());
+       }
+}

Reply via email to