TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mario Figueroa
NA
16
2.5k
c# equivalent of java
Jul 30 2019 8:40 PM
What is the equivalent in c # of the following java code?
import
java.security.MessageDigest;
import
javax.xml.bind.DatatypeConverter;
public
String algoritmoHash(
byte
[] pArchivo, String algorithm) {
String hashValue =
""
;
try
{
MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
messageDigest.update(pArchivo);
byte
[] digestedBytes = messageDigest.digest();
hashValue = DatatypeConverter.printHexBinary(digestedBytes).toLowerCase();
}
catch
(Exception e) {
System.out.println(
"Error generando Hash"
);
}
return
hashValue;
}
And what is the equivalent of this other java code?
import
java.util.zip.Checksum;
import
java.util.zip.CRC32;
public
String calCrc32(
byte
[] data) {
Checksum checksum =
new
CRC32();
checksum.update(data,
0
, data.length);
long
checksumValue = checksum.getValue();
String hex = Long.toHexString(checksumValue).toUpperCase();
while
(hex.length() <
8
) {
hex =
"0"
+ hex;
}
return
hex;
}
Reply
Answers (
1
)
Changing ComboBox background color
how to prevent showing pdf file google search