message-digest


openssl digest different in c compared to java

ぃ、小莉子 提交于 2019-12-24 08:58:34
问题 Following is the code which is part of the DigitalSigning Handler final String NAMESPACEURI_WSSECURITY_WSU= "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; final String NAMESPACEURI_WSSECURITY_WSSE = "http://docs.oasisopen.org/wss/2004/01/oasis-200401-wss-wssecurity-secext- 1.0.xsd"; final String NAMESPACEURI_XMLSIGNATURE_DS = "http://www.w3.org/2000/09/xmldsig#"; final String ATTRIBUTENAME_X509TOKEN = "http://docs.oasis-open.org/wss/2004/01/oasis-200401

S/MIME verification with x509 certificate

妖精的绣舞 提交于 2019-12-24 07:08:08
问题 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()); System.out.println("wbilem"); CertStore certs = s.getCertificatesAndCRLs("Collection", "BC"); SignerInformationStore signers = s.getSignerInfos(); Collection c = signers.getSigners(); Iterator it = c.iterator(); while (it.hasNext()) { File f = new File(

Java MD5 hashing not matching C# MD5 hashing

[亡魂溺海] 提交于 2019-12-19 03:45:17
问题 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"); messageDigest.update(encryptionKey.getBytes("UTF-8"), 0, encryptionKey.length()); byte[] encryptionKeyBytes = messageDigest.digest(); Now correct me if I'm wrong, but the above code hashes the string with the MD5 algorithm. And I want the same result when I hash the same string in C#.

why is hash output fixed in length?

坚强是说给别人听的谎言 提交于 2019-12-12 11:41:50
问题 Hash functions always produce a fixed length output regardless of the input (i.e. MD5 >> 128 bits, SHA-256 >> 256 bits), but why? I know that it is how the designer designed them to be, but why they designed the output to have the same length? So that it can be stored in a consistent fashion? easier to be compared? less complicated? 回答1: Because that is what the definition of a hash is. Refer to wikipedia A hash function is any function that can be used to map digital data of arbitrary size

How is an MD5 or SHA-X hash different from an encryption?

♀尐吖头ヾ 提交于 2019-12-12 02:39:50
问题 I've read a couple times that MD5 is not an encryption, e.g. on MD5 ... Encryption? or Command Line Message Digest Utility. Well, I get that it's a hash/message digest, and the explanation in the links above says an encryption has to have a key, while hash/md is a cryptographic hash function that produces just a signature. I don't really understand the difference. Couldn't you see the cryptographic hash function / algorithm as a key? Also, what is the difference between something that's

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

試著忘記壹切 提交于 2019-12-11 20:15:30
问题 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 OutputStream , and then I need to write the hash of the file at the end (also through the request body). Thanks to the DigestInputStream , I'm able to compute the hash live, so after the file body has been sent to the OutputStream , the hash becomes available

Does every Android phone support SHA-256

淺唱寂寞╮ 提交于 2019-12-08 23:18:02
问题 So reading this post: How can I calculate the SHA-256 hash of a string in Android? and the docs: http://developer.android.com/reference/java/security/MessageDigest.html I'm curious; which phones will support SHA-256? In the docs, the line about the 'NoSuchAlgorithmException' makes me think that some phones don't support all algorithms. Before I go implementing this for an app and expecting it to work the same on all phones I want to know if anyone knows anything about this...? I find it

How to set MessageDigest seed?

ぐ巨炮叔叔 提交于 2019-12-08 02:37:45
问题 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 variables: h0 = 0x67452301 h1 = 0xEFCDAB89 h2 = 0x98BADCFE h3 = 0x10325476 h4 = 0xC3D2E1F0 However the MessageDigest class, as described in the Online Java Manual, provides no API for setting these initial variables. In fact, it doesn't state the value of the

How to set MessageDigest seed?

你说的曾经没有我的故事 提交于 2019-12-06 12:01:51
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 variables: h0 = 0x67452301 h1 = 0xEFCDAB89 h2 = 0x98BADCFE h3 = 0x10325476 h4 = 0xC3D2E1F0 However the MessageDigest class, as described in the Online Java Manual , provides no API for setting these initial variables. In fact, it doesn't state the value of the initial variables. How can I set the initial seed for the SHA-1 algorithm? Where is an example of SHA-1

Hashing raw bytes in Python and Java produces different results

為{幸葍}努か 提交于 2019-12-05 04:10:40
问题 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 (exactly 2048 bits long) in a specific way (2nd line of my Python code example). For my examples, the original 2048-bit integer is stored as big_int and bigInt in Python and Java respectively, and both variables contain the same number. Python2 code I

工具导航Map