Questions tagged [message-digest]

131 questions
1
vote
1 answer

Message Digest in swift

I need to generate Message Digest in Swift with SHA-256 variant with SALT. I am using CryptoSwift library in Swift for all the encryption/decryption. Now I am stuck at generating Message Digest which matches with Java code in Android as below. If…
Dhaval H. Nena
  • 3,992
  • 1
  • 37
  • 50
1
vote
1 answer

MessageDigestMessage Digest returning different key after first digest

Here is how I initialize MessageDigest private static MessageDigest messageDigest; public static final String SALT_DO_NOT_CHANGE = "somesalt"; static { try { messageDigest = MessageDigest.getInstance("SHA-512"); …
Viraj Nalawade
  • 3,137
  • 3
  • 28
  • 44
1
vote
1 answer

How to get an int type hash using message digest for bloom filters

I am trying to implement a bloom filter in java and one type of hash needs to be using the message digest. During the add method the other hashes I have created are used to set the index of the bitset to true. I need to create a hash using message…
slb
  • 33
  • 3
1
vote
0 answers

Bad Padding Exception

I am trying a program to first encrypt and decrypt a string and in between encoding it into 64base and then decoding it into 64base(this is required). But I am getting the below error. What is the possible fix? Exception in thread "main"…
1
vote
0 answers

Generate hash from chunked file

I'm programming a web service for uploading long files. The client sends the chunks whenever it wants. I need to calculate the hash of this file while theese chunks are received. I've seen that you can do somenthing like this: byte[] buf = new…
1
vote
2 answers

Why do BouncyCastle Keccak sha-384 and MessageDigest sha-384 have different output?

Simple example hashing an array of just one byte: import java.security.MessageDigest; import java.util.Arrays; import org.bouncycastle.jcajce.provider.digest.Keccak; public class Program { public static void main(String[ ] args) { //…
Roman Semko
  • 1,541
  • 5
  • 18
  • 27
1
vote
1 answer

Use SHA512Digest in cd1 like using MessageDigest in java

i am trying to convert a java api to cd1 api of encryption... i have in java this method: private static byte[] encodePassword(String password,String salt) throws UnsupportedEncodingException { String…
Zain Elabidine
  • 349
  • 5
  • 16
1
vote
1 answer

Package in java 's equivalent in codenameone

i have a java api that uses those packages: import java.security.MessageDigest; import java.security.SecureRandom; import java.util.Base64; i find the equivalence of: the second(import javabc.SecureRandom;) and the third(import…
Zain Elabidine
  • 349
  • 5
  • 16
1
vote
0 answers

MD5 algorithm implemented in python

So I am trying to implement the MD5 algorithm in Python. I've read reams of sources, the original document from ietf by Rivest, and I still have some things I don't get: So this is the code: import math T=[] for i in range(64): …
user9686271
1
vote
1 answer

How to use update Method of Message Digest Class

I'm working on a data encryption project and just wanted to ask how to use the method update of message digest class. In a code snippet of MD5 implementation, this was written. import java.security.MessageDigest; import java.util.*; class MD5{ …
Saurabh Kumar
  • 2,088
  • 14
  • 17
1
vote
1 answer

Method Digest on Main UI Thread

I would like to compute the sha256 digest on a string. Is it safe to compute the hash on the main ui thread? Or do i have to run this in the background?
prostock
  • 9,327
  • 19
  • 70
  • 118
1
vote
1 answer

How to convert Java MessageDigest with two update statements to C#

How can I convert this Java code to C#? byte[] a = ...some byte array...; byte[] b = ...some byte array...; MessageDigest m_Hash = MessageDigest.getInstance("SHA-1"); m_Hash.update(a); m_Hash.update(b); byte[] ub =…
Brian Rice
  • 3,107
  • 1
  • 35
  • 53
1
vote
1 answer

Difference between Merkle–Damgård and sponge-function used in KECCAK

Hello to the nice Stackoverflow community! I have difficulties understanding the difference between the Merkle–Damgård construction and the sponge-function used in KECCAK. The Merkle–Damgård Construction takes in the message-blocks iteratively, but…
tietze111
  • 321
  • 1
  • 2
  • 15
1
vote
1 answer

MD5 hashes different values with same input

I have the following Scala function: import java.security.MessageDigest def md5(s: String) = MessageDigest.getInstance("MD5").digest(s.getBytes).toString() When I encrypt the same string, I always get different results, what could be the problem?…
ps0604
  • 1,227
  • 23
  • 133
  • 330
1
vote
0 answers

BigInteger always is same

I am trying to create a unique name for each file you upload to my server from my Jar. I am using the MessageDigest MD5 class to create, but unfortunately I always get the same name. BufferedImage buffImg =…
hateful
  • 141
  • 2
  • 13
1 2 3
8 9