Questions tagged [message-digest]
131 questions
2
votes
1 answer
MessageDigest.digest() returning same hash for different strings having Norwegian character
I am calling MessageDigest.digest() method to get the hash of the password.
If the password contains a Norwegian character e.g. 'ø', this method returns same hash for different strings with different last character.
"Høstname1" and "Høstname2" have…

namang029
- 23
- 4
2
votes
1 answer
How to implement SHA256 on Java Card 2.2.1?
I'm trying to implement RSA sign on Java Card version 2.2.1. I have implemented RSA 2048 and tested this successfully, but when trying to hash using the MessageDigest class, I'm unable to get the correct answer in response.
Here is my…

MJay
- 987
- 1
- 13
- 36
2
votes
1 answer
Hashing raw bytes in Python and Java produces different results
I'm trying to replicate the behavior of a Python 2.7 function in Java, but I'm getting different results when running a (seemingly) identical sequence of bytes through a SHA-256 hash. The bytes are generated by manipulating a very large integer…

jming
- 110
- 8
2
votes
1 answer
SHA1 MessageDigest and CommonCrypto updates getting different results
I'm trying to recreate the implementation of PasswordDeriveBytes from VB.NET and so far I have implemented in iOS Objective C code its giving me different results from a Java implementation.
The reason why we try to recreate the implementation of…

Tertel
- 31
- 4
2
votes
3 answers
How to set MessageDigest seed?
The MessageDigest class implements the SHA-1 algorithm (among many others). The SHA-1 algorithm allows one to use different "seeds" or initial digests. See SHA-1 Psuedocode
The algorithm initializes variables, or the seed:
Initialize…

Thomas Matthews
- 56,849
- 17
- 98
- 154
2
votes
1 answer
messagedigest object throws NoSuchAlgorithm when used as a field/static variable in java
I am able to call MessageDigest as a local variable in main() method of my code, but whenever I try creating a field variable of MessageDigest in a class, and try initializing it in a constructor, it throws a NoSuchAlgorithm exception.
My gut…

khanna
- 718
- 10
- 24
2
votes
3 answers
When to use salt with Message Digest
I have using message digest, I have seen it being used sometimes with salt
synchronized (hasher) {
hasher.update(salt); // "Updates" the digest using the specified byte.
salt++;
digest =…

JavaDeveloper
- 5,320
- 16
- 79
- 132
2
votes
2 answers
Zip File md5 Checksum - Every Time Different
I have an Android applications which gets zip file's md5 checksum. I use it to compare the file with file on a server. My problem is that every time I try to generate the md5 for the same file, the checksum is different. I'm posting my methods here.…

dephinera
- 3,703
- 11
- 41
- 75
2
votes
1 answer
same message digest but different signature value
I have 2 signature file that only different in namespace. Both these file provide the same message digest. I use the same key to sign with the same algo RSA-SHA1. But there are 2 different signature. I think that as long as the message digest, key…

Kristine T
- 101
- 8
1
vote
2 answers
Why are my two MD5 hashing methods producing different hashes?
I'm new to java and really need some help. I created a command line tool in order to get an MD5 hash of a file. This worked so I then tailored my code to put it in GUI form. The two programs give different hashes of the same file which is confusing.…

DMo
- 591
- 2
- 6
- 13
1
vote
2 answers
S/MIME verification with x509 certificate
I have some problems with verifying S/Mime signed message with x509 certificate. This is my code:
public class verifyMsg {
private static void verify(SMIMESignedParser s) throws Exception {
Security.addProvider(new BouncyCastleProvider());
…

s7474
- 58
- 2
- 8
1
vote
0 answers
Is Java MessageDigest.digest() guaranteed to return an unreferenced byte array?
When I call MessageDigest.digest() and similar methods that produce the final hash, is the resulting byte array guaranteed to be a new copy, free of other references? Or do I still need to make a defensive copy using e.g.…

Garret Wilson
- 18,219
- 30
- 144
- 272
1
vote
0 answers
Incorrect XML digest value
Description
I'm trying to calculate a digest value for a XML digital signature. The problem is that I can't calculate a correct digest value.
For the testing purpose I'm using a sample request which is populated with the valid data and my goal is to…

Tommy Chu
- 103
- 1
- 6
1
vote
0 answers
MessageDigest MD5 generation of Multipart Huge file
I wish to generate an MD5 hash of a very large file using MessageDigest.
However, because the file is so big, i never have access to the complete stream of bytes. I only have access to N segments of the file. (Processed using multipart uploads).
In…

MeBigFatGuy
- 28,272
- 7
- 61
- 66
1
vote
1 answer
Can android throw NoSuchAlgorithmException for MD5
Android's MessageDigest page says MD5 is supported from day one -
https://developer.android.com/reference/java/security/MessageDigest
But the MessageDigest.getInstance("MD5") method can throw NoSuchAlgorithmException and there is no getMD5Instance…

arunskrish
- 417
- 6
- 13