Questions tagged [message-digest]

131 questions
0
votes
1 answer

Trying MD5 Hash in java

Hi I have written a class to create a hash for a String input but my Program sometimes give same hash for two different input. import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Test { public byte[]…
0
votes
1 answer

Translating Java password hashing method to JS implementation

I would like to translate Java code password hashing used in Blynk IoT software that I can use in Express.js app. Thanks for any help! Java code: https://www.onlinegdb.com/HJe19lyFB import java.nio.charset.StandardCharsets; import…
patryk0493
  • 15
  • 6
0
votes
1 answer

how to calculate SHA-256 of a bitmap image in android studio?

How to calculate SHA-256 of a bitmap image in android studio? I have already tried converting image into byte array and then find its message digest but it gives a completely different answer than what I find using online SHA-256 converters. I know…
Thatz'it
  • 11
  • 2
0
votes
1 answer

Is there's a hexToString implemented method in Java for Hashing?

I'm working in a little method that hashes a String. Looking for information, I could find that MessageDigest can help me to make this task, here Compute SHA-1 of byte array But now I have a question. It seems that the procedure to hash a String…
jomaora
  • 1,656
  • 3
  • 17
  • 26
0
votes
1 answer

How can i match a CERTIFICATE against CSR in JAVA

I don't have idea how to achieve this. I refereed this link where i can match my csr with certificate. In this tool they are getting the hash from certificate and csr and matching them. So I also tried to get hash but i am not able to get proper…
Prakash
  • 13
  • 6
0
votes
1 answer

MessageDigest to CryptoJS digest byteBuffer SHA512

i try to digest an array of bytes with SHA512 Java: MessageDigest sha512 = MessageDigest.getInstance("SHA-512"); System.out.println("sha512: "+Arrays.toString(sha512.digest(buffer.array()))); this sample computes with input: [18, 52, 49, 114, -101,…
0
votes
1 answer

Converting toHexString and MessageDigest in Java to c# equivalent

I have problem converting the following Java code into toHexString and MessageDigest equivalent to C#.net code. I spend much time in converting them, but seems the result can never be the same. Please help me especially in toHexString part. import…
eric
  • 147
  • 2
  • 4
  • 12
0
votes
1 answer

MessageDigest gives two differents hash for a same file

I'm using MessageDigest to make the hash of files using SHA 256 as follow: byte[] hash = new byte[32]; MessageDigest digest = MessageDigest.getInstance("SHA-256"); try (InputStream input = Files.newInputStream(…
Ablia
  • 317
  • 1
  • 3
  • 14
0
votes
0 answers

How to Generate PKCS7 for Sha256 hash of any file or plain text in java and verification process?

Code for Pkcs7 generation @SuppressWarnings({ "unchecked", "rawtypes" }) public static byte[] createDetachedSignature() throws NoSuchAlgorithmException, NoSuchProviderException, DSCException, InvalidKeyException, SignatureException,…
0
votes
1 answer

Changing order of sha 256 update change the value

if i creat a messagedigist then update it with bytes values, change order change the ouput of the hash Example BigInteger d_KGC = new BigInteger("773182302672421767750165305491852205951657281488"); BigInteger r_KGC = new…
Sherif Awad
  • 171
  • 2
  • 10
0
votes
0 answers

Spring MessageDigestPasswordEncoder encodePassword iOS equivalent?

been breaking my head for the past day, given a token and salt, I need to generated a hashed token that matches the one produce by Spring's…
David Homes
  • 2,725
  • 8
  • 33
  • 53
0
votes
1 answer

Can someone explain how this MD5 MessageDigest code works?

I am studying MD5 and also SHA with MessageDigest. Here is a code I have from class that implements MD5 with MessageDigest. I am having trouble understanding it. So it gets the "instance" of MD5. I guess that is the MD5 algorithm? Then it updates…
RockOn
  • 197
  • 1
  • 19
0
votes
1 answer

sha1.ComputeHash(fileStream)

/// /// 读取指定文件块数据Sha1 /// /// /// @return private static MessageDigest calSha1(BufferedInputStream fis) { MessageDigest sha1 = null; try { byte[] buffer = new byte[1024]; int…
陈黎栋John
  • 175
  • 1
  • 9
0
votes
1 answer

OpenSSL: can output size of EVP_DigestFinal_ex be greater than the digest size?

OpenSSL EVP_DigestFinal_ex has the following documentation: "EVP_DigestFinal_ex() retrieves the digest value from ctx and places it in md. If the s parameter is not NULL then the number of bytes of data written (i.e. the length of the digest) will…
SkypeMeSM
  • 3,197
  • 8
  • 43
  • 61
0
votes
0 answers

how can checksum calculated be different on different hosts which have same code running?

Is there a way that the checksum calculated using MessageDigest (Java) could be different on 2 hosts? What could be the factors that could lead to this? I checked the hardware and its same on both hosts.
user2612586
  • 45
  • 1
  • 5
1 2 3
8 9