记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
a2deeba5
Commit
a2deeba5
authored
May 08, 2026
by
姜秀龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refs/heads/wepay-paysign' into container-test
parents
7f03d5f5
52359170
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
11 deletions
+3
-11
MD5Utils.java
...c/main/java/com/liquidnet/commons/lang/util/MD5Utils.java
+3
-11
No files found.
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/MD5Utils.java
View file @
a2deeba5
package
com
.
liquidnet
.
commons
.
lang
.
util
;
package
com
.
liquidnet
.
commons
.
lang
.
util
;
import
java.math.BigInteger
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.security.MessageDigest
;
import
java.security.MessageDigest
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.NoSuchAlgorithmException
;
...
@@ -20,20 +19,13 @@ public class MD5Utils {
...
@@ -20,20 +19,13 @@ public class MD5Utils {
* 使用md5的算法进行加密
* 使用md5的算法进行加密
*/
*/
public
static
String
md5
(
String
plainText
)
{
public
static
String
md5
(
String
plainText
)
{
byte
[]
secretBytes
=
null
;
try
{
try
{
secretBytes
=
MessageDigest
.
getInstance
(
"md5"
).
digest
(
plainText
.
getBytes
(
Charset
.
defaultCharset
()));
byte
[]
secretBytes
=
MessageDigest
.
getInstance
(
"md5"
).
digest
(
plainText
.
getBytes
(
Charset
.
defaultCharset
()));
// 不可使用 BigInteger.toString(16):会吞掉高位为 0 的半字节/整字节,导致 MD5 非固定 32 位十六进制(微信二次签名会偶发失败)
return
bufferToHex
(
secretBytes
);
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
RuntimeException
(
"没有md5这个算法!"
);
throw
new
RuntimeException
(
"没有md5这个算法!"
);
}
}
String
md5code
=
new
BigInteger
(
1
,
secretBytes
).
toString
(
16
);
// 16进制数字
// 如果生成数字未满32位,需要前面补0
if
(
md5code
.
length
()
<
32
)
{
for
(
int
i
=
0
;
i
<=
32
-
md5code
.
length
();
i
++)
{
md5code
=
"0"
+
md5code
;
}
}
return
md5code
;
}
}
protected
static
MessageDigest
messagedigest
=
null
;
protected
static
MessageDigest
messagedigest
=
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment