Questions tagged [message-digest]

131 questions
4
votes
2 answers

How to calculate message digests in custom output stream?

I would like to implement an OutputStream that can produce MessageDigests. Likewise, I already have an InputStream implementation of it here, which works fine and extends FilterInputStream. The problem is this: if I'm extending FilterOutputStream,…
carlspring
  • 31,231
  • 29
  • 115
  • 197
4
votes
1 answer

NoSuchAlgorithm exception when using MD5

import java.security.*; MessageDigest md = MessageDigest.getInstance("MD5"); fails with NoSuchAlgorithm exception. MessageDigest docs](http://docs.oracle.com/javase/7/docs/api/java/security/MessageDigest.html) say: Every implementation of the…
4
votes
3 answers

Hashing image bytes with SHA-256 yields many random collisions, what am I doing wrong?

I'm using the SHA-256 algorithm to detect identical images in a database. Because we use a lot of different image formats I don't want to compute the hash directly on the file. Instead I want to extract the pixel data and compute the hash on that.…
4
votes
1 answer

Java MD5 hashing not matching C# MD5 hashing

I know very little about encryption/hashing. I have to hash an encryption key. The example in Java is like this... String encryptionKey = "test"; MessageDigest messageDigest = MessageDigest.getInstance("MD5"); …
Theo
  • 2,609
  • 1
  • 26
  • 27
3
votes
1 answer

Something like a message digest but that progressively describes a file

I have a set of geographically remote nodes with heterogeneous operating systems which need to transfer files and updates around using a Java program I am writing. At present I need to send the entire file again if the file changes. Is there a way…
feldoh
  • 648
  • 2
  • 6
  • 19
3
votes
2 answers

AWS SQS, How to calculate the MD5 message digest for message attributes

I'm currently trying to figure out how to calculate the MD5 message digest for message attributes in AWS. I'm following the uri SQS message metadata > Calculating the MD5 message digest for message attributes Although this seems straight forward I'm…
Samyne
  • 308
  • 1
  • 13
3
votes
1 answer

Java equivalent for PHP's pack function

I have a sample application which generates a SHA1 hash in PHP as follows. base64_encode(pack('H*', sha1($pass))); I tried to achieve the same in Java, but so far, the output is different. The approach I used is as follows (Base64 and Hex classes…
Yohan Liyanage
  • 6,840
  • 3
  • 46
  • 63
3
votes
3 answers

protocol to use password hashing with salt

I am trying to understand what information are needed to be sent in a web application . Basically I have a web app running on a web server , a database which has a user table with hashed password and salt , and of course the web client with…
user670800
  • 1,107
  • 1
  • 11
  • 16
3
votes
1 answer

Generating an MD5 Hash with a char[]

How would one go about converting a char[] password obtained using this method: char[] password = passwordInputField.getPassword(); To an MD5 Hash? Normally I would use the method below, but getBytes is only compatible with Strings: MessageDigest…
3
votes
2 answers

java MD5 encryption minus value in byte array

Hello I am using below code to encrypt a string. I found MD5 make working in -127 - +128 values. I am getting value in minus for. public static void main(String[] args) throws Exception { String message = "smile"; encrypt("Jack the…
NovusMobile
  • 1,813
  • 2
  • 21
  • 48
2
votes
1 answer

Is there a way to shorten a java.security.MessageDigest generated value?

If I generate a message digest (for a security feature in my app) using this Java code: java.security.MessageDigest saltDigest = MessageDigest.getInstance("SHA-256"); saltDigest.update(UUID.randomUUID().toString().getBytes("UTF-8")); String digest =…
arezzo
  • 2,915
  • 2
  • 15
  • 14
2
votes
2 answers

Get sha1 message digest from plaintext+private key in delphi

I want to create a Sha1 message digest, and it should use my private key as input along with the plain text. Everything I have found so far either dont use a private key or just take a lot of certificates as input.
2
votes
1 answer

Java byte array comparison of MessageDigest SHA1 result and original hash value?

I would like to compare two byte arrays. One is calculated from plaintext with MessageDigest SHA1, the other is the hex itself in byte array, without calculation. MessageDigest returns 20 byte long result, String.getBytes() returns 40 byte long…
Gábor DANI
  • 2,063
  • 2
  • 22
  • 40
2
votes
2 answers

Collision Attacks, Message Digests and a Possible solution

I've been doing some preliminary research in the area of message digests. Specifically collision attacks of cryptographic hash functions such as MD5 and SHA-1, such as the Postscript example and X.509 certificate duplicate. From what I can tell in…
Matthieu N.
2
votes
0 answers

MessageDigest implementation of MurmurHash2

I want to use the MurmurHash2 algorithm (32bit) for download verification in a Java application. There exist various implementations on GitHub, but I want to use a MessageDigest implementation, as I am interested in how to "translate" a hashing…
user6945931
1
2
3
8 9