FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java-Hackerrank-Solutions/Java/Advanced/JavaMD5.java at main · Manush54/Java-Hackerrank-Solutions · GitHub
Manush54
/
Java-Hackerrank-Solutions
Public
Notifications
You must be signed in to change notification settings
Fork
9
Star
21
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Java-Hackerrank-Solutions
/
Java
/
Advanced
/
JavaMD5.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (23 loc) · 779 Bytes
Breadcrumbs
Java-Hackerrank-Solutions
/
Java
/
Advanced
/
JavaMD5.java
Copy path
File metadata and controls
25 lines (23 loc) · 779 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import
java
.
io
.*;
import
java
.
util
.*;
import
java
.
security
.
MessageDigest
;
import
java
.
util
.
Scanner
;
public
class
JavaMD5
{
public
static
void
main
(
String
[]
args
) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner
sc
=
new
Scanner
(
System
.
in
);
String
str
=
sc
.
next
();
sc
.
close
();
try
{
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
md
.
update
(
str
.
getBytes
());
// return bytesToHex(md.digest
byte
[]
digest
=
md
.
digest
();
for
(
byte
b
:
digest
) {
System
.
out
.
printf
(
"%02x"
,
b
);
}
}
catch
(
Exception
ex
) {
throw
new
RuntimeException
(
ex
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL