Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
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
YZG
yzg-util
Commits
0f0d6ff2
Commit
0f0d6ff2
authored
May 08, 2019
by
yanzg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Excel导出功能
parent
d491b855
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
StringHelper.java
...c/main/java/com/yanzuoguang/util/helper/StringHelper.java
+11
-11
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/StringHelper.java
View file @
0f0d6ff2
...
...
@@ -14,6 +14,7 @@ import java.util.UUID;
/**
* 字符串帮主类
*
* @author 颜佐光
*/
public
class
StringHelper
{
...
...
@@ -748,15 +749,8 @@ public class StringHelper {
* @return 加密后的字符串
*/
public
static
String
md5
(
String
string
)
{
byte
[]
hash
=
null
;
try
{
hash
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
string
.
getBytes
(
"UTF-8"
));
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
byte
[]
hash
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
string
.
getBytes
(
"UTF-8"
));
StringBuilder
hex
=
new
StringBuilder
(
hash
.
length
*
2
);
for
(
byte
b
:
hash
)
{
if
((
b
&
0xFF
)
<
0x10
)
{
...
...
@@ -765,6 +759,12 @@ public class StringHelper {
hex
.
append
(
Integer
.
toHexString
(
b
&
0xFF
));
}
return
hex
.
toString
();
}
catch
(
NoSuchAlgorithmException
e
)
{
e
.
printStackTrace
();
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
return
StringHelper
.
EMPTY
;
}
/**
...
...
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