Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-fb
Overview
Overview
Details
Activity
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
王衍超
cloud-fb
Commits
624fc1ce
Commit
624fc1ce
authored
May 17, 2021
by
高晓磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加获取32位md5hash值的方法
parent
f682dcb2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
Digests.java
...on/src/main/java/com/beecode/inz/common/util/Digests.java
+36
-0
No files found.
backend/inz.common/src/main/java/com/beecode/inz/common/util/Digests.java
View file @
624fc1ce
...
...
@@ -140,6 +140,42 @@ public class Digests {
return
DigestUtils
.
md5DigestAsHex
(
input
);
}
/**
*
* @param plainText
* 明文
* @return 32位密文
*/
public
static
String
md5encryption
(
String
plainText
)
{
String
re_md5
=
""
;
try
{
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
md
.
update
(
plainText
.
getBytes
());
byte
b
[]
=
md
.
digest
();
int
i
;
StringBuilder
buf
=
new
StringBuilder
(
""
);
for
(
byte
value
:
b
)
{
i
=
value
;
if
(
i
<
0
)
{
i
+=
256
;
}
if
(
i
<
16
)
{
buf
.
append
(
"0"
);
}
buf
.
append
(
Integer
.
toHexString
(
i
));
}
re_md5
=
buf
.
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
re_md5
;
}
/**
* base64编码
*/
...
...
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