Questions tagged [message-digest]

124 questions
0
votes
4 answers

converting string to md5 gives add number of digits

I am trying to convert a String to its MD5 representation with this code: public static void main(String[] args) throws NoSuchAlgorithmException { String s = "oshai"; MessageDigest m = MessageDigest.getInstance("MD5"); …
oshai
  • 13,307
  • 24
  • 74
  • 128
0
votes
1 answer

What does resetting MessageDigest do?

Here is the code I'm talking about: md.reset(); What does the reset() method do to the MessageDigest object? Why is it necessary?
0
votes
1 answer

Bouncy Castle Getting content from signature and X509Certificate

I am very new to Bouncy Castle.I want to know is there any way using Bouncy Castle API that i can get original content if i only have signature using X509Certificate with public key.I am not finding any way as we have only public key.We don't have…
Swapnil
  • 2,225
  • 3
  • 22
  • 46
0
votes
1 answer

Regenerating SHA-1 hash not matching stored database hash

I'm trying to implement SHA1 password hashing with key-stretching combined with a UUID as a salt. The salt is stored as a column in my usersTable inside the database backend, thus each user will be generated their own unique salt. My problem is that…
Ryan Fletcher
  • 623
  • 2
  • 6
  • 20
0
votes
3 answers

Java message digest [MD5] not producing expected hash

I am trying to generate an MD5 hex hash using the following code: String password = "password"; MessageDigest digest = MessageDigest.getInstance("MD5"); ByteArrayInputStream bais = new ByteArrayInputStream(password.getBytes()); int size =…
carlspring
  • 27,224
  • 23
  • 101
  • 178
0
votes
1 answer

url safe base64 in MySQL

Is MySQL's TO_BASE64 URL safe? Using java, I can write the following code: import org.apache.commons.codec.binary.Base64; public class Main { public static void main(String[] args) { String text = "SomeText"; byte[] input =…
pshah
  • 1,954
  • 1
  • 19
  • 39
0
votes
0 answers

DigestInputStream -> compute the hash without slowdown when the consumer part is the bottleneck

I have an application that needs to transfer files to a service like S3. I have an InputStream of that incoming file (not necessarily a FileInputStream), and I write this InputStream to a multipart request body that is represented by an…
Sebastien Lorber
  • 79,294
  • 59
  • 260
  • 386
0
votes
1 answer

SHA_256 functions corrupting memory space

I've been trying to use the SHA_256 functions in sha256.h on a FreeBSD 9.1 system but it seems to be corrupting memory space of my program causing all kinds of manic behavior. I wrote up a quick program to just to play with those functions and still…
0
votes
2 answers

Verifying file digests

Say I have 'n' number of files, for each of which I have CRC32, MD5 and SHA1 digests Now these 'n' number of files are actually split files/archives of single large file. When these smaller files are recombined/joined into the larger file, we can…
PoorLuzer
  • 21,986
  • 7
  • 26
  • 33
0
votes
2 answers

Hashing password and comparing with MD5

I have the following requirement. 1. save a user password converted to hash(digested) 2. when comparing with data base, add random bytes with the password given from user 3. now send the random bytes added password to DAO class 4. separate the…
Java Questions
  • 7,372
  • 37
  • 109
  • 169
-1
votes
1 answer

SHA256 hash smillar to .Net hash

I have am doing an Oauth App, where in few parts the hash is calculated via a .Net application, following is the .Net code to compute the hash public static string GetBase64CodeChallange(string str) { using (SHA256 sha256Hash = SHA256.Create()) …
Rober
  • 71
  • 8
-1
votes
1 answer

How can I generate an MD5 hash on Java Card 2.2.1?

I'm trying to hash an 8-byte message (maybe need to enlarge it to 128) using Java Card which supports MD5. This is my source code: package net.sourceforge.globalplatform.jc.helloworld; import javacard.framework.*; import javacard.security.*; import…
MJay
  • 850
  • 10
  • 25
-1
votes
2 answers

MD5 Python Implementation

I am looking to learn more about hashing algorithms, specifically the Message Digest 5 algorithm. And specifically in a slightly more up-to-date version of Python (3+.) I know you can do the whole from hashlib import md5 thing, and that…
Mick Ashton
  • 186
  • 3
  • 14
-1
votes
1 answer

I am comparing return value of BufferedReader.readLine() and a string, but it's not working

What I have done is, I have created two files - one (message.txt) has the message "hello!", and I have created its Messagedigest and stored it in second file (md.txt). Now I am trying to create a program where it accepts both the message and its md,…
-1
votes
1 answer

Wrong SHA-256 hash of a string in MessageDigest

in some tests i using MessageDigest library in Groovy and sometimes this function returns incorrect value. Here is my code below: import java.security.MessageDigest; String.metaClass.toSHA256 = { def messageDigest =…
mabUno
  • 13
  • 2
  • 9
1 2 3
8
9