sha

How create SHA224SUM in java

落爺英雄遲暮 提交于 2019-12-03 09:13:39
I need create hash from my string using analog Linux command SHA224SUM in java under Android. I try use: MessageDigest messageDigest224 = MessageDigest.getInstance( "SHA-224"); byte[] bSHA224 = messageDigest224.digest( "hello word".getBytes()); But I get error MessageDigest SHA-224 implementation not found java.security.NoSuchAlgorithmException: MessageDigest SHA-224 implementation not found SHA-512, SHA-1 algorithm work fine. Please get me link to analog SHA224 in Java. Please any ideas. 来源: https://stackoverflow.com/questions/26647675/how-create-sha224sum-in-java

Can't get to have SHA-256 hash working with my spring security

两盒软妹~` 提交于 2019-12-03 09:12:32
I am using the Spring Roo framework which uses Spring Security as security framework. I configured it the following way: <authentication-manager alias="authenticationManager"> <!-- SHA-256 values can be produced using 'echo -n your_desired_password | sha256sum' (using normal *nix environments) --> <authentication-provider> <password-encoder hash="sha-256"> <!-- <salt-source user-property="login"/> --> </password-encoder> <jdbc-user-service data-source-ref="dataSource" users-by-username-query=" SELECT login, password, enabled FROM user WHERE login = ?" authorities-by-username-query=" SELECT u

Migrate passwords from Drupal 7 to Django

元气小坏坏 提交于 2019-12-03 07:08:00
I am migrating a site from Drupal 7 to Django 1.4, including the current users. How can I work with the passwords that were hashed by Drupal? According to this , Drupal 7 hashes passwords using SHA-512 (they are stored in the form of a string starting with "$S$"). Django 1.4 now contains a number of options for storing passwords, with a default of SHA-256, but I can't find an option for SHA-512. While this app appears to allow the use of SHA2 algorithms, I'm not sure it's compatible with Django 1.4 (as 1.4 has a flexible password hasher). What is the simplest way to do this? ETA: I've built a

Delphi: How to calculate the SHA hash of a large file

被刻印的时光 ゝ 提交于 2019-12-03 06:00:18
Hi I need to generate a SHA over a 5 Gig file Do you know of a non string based Delphi library that can do this ? Davy Landman You should use DCPcrypt v2 and read your file buffered and feed the SHA hasher with the buffer until you've read the complete 5GB file. If you want to know how to read a large file buffered, see my answer about a file copy using custom buffering . so in concept (no real delphi code!): function GetShaHash(const AFilename: String) begin sha := TSHAHasher.Create; SetLength(Result, sha.Size); file := OpenFile(AFilename, GENERIC_READ); while not eof file do begin BytesRead

How does Apple's codesign utility decide which SHA algorithm(s) to sign a shared library with?

社会主义新天地 提交于 2019-12-03 05:41:35
First, a little background: I'm investigating why my company's MacOS/X application (which by all accounts appears to be correctly signed; it runs fine under MacOS/X 10.11.x and 10.12.x; Gatekeeper is fine with it on all MacOS versions; "spctl --assess", and "codesign -vvvv" all say it satisfies its requirement on all OS versions) nevertheless won't launch under OS/X 10.10.x -- under 10.10.x when I try to launch it, I get a Crash Report where dyld complains that some of the libraries aren't signed correctly: Dyld Error Message: Library not loaded: @executable_path/../Frameworks/libcrypto.1.0.0

When should I use SHA-1 and when should I use SHA-2?

空扰寡人 提交于 2019-12-03 05:34:39
In my c# application, I'm using RSA to sign files before being uploaded on the database of my company by the person who is uploading and here I have to choose SHA-1 or SHA-2 for computing the hash. As any other component in programming, I know that there must be a "use this here" and "use that there" for the two of them. So, When this? and when that? EDIT: My question is: What is the difference regarding performance? and not regarding security, as I already know that SHA-2 is more solid secure than SHA-1. In this Link a comparison between different types of SHA-2 noting when to use SHA-512 and

Hashing in SHA512 using a salt? - Python

╄→гoц情女王★ 提交于 2019-12-03 03:31:04
问题 I have been looking through ths hashlib documentation but haven't found anything talking about using salt when hashing data. Help would be great. 回答1: Samir's answer is correct but somewhat cryptic. Basically, the salt is just a randomly derived bit of data that you prefix or postfix your data with to dramatically increase the complexity of a dictionary attack on your hashed value. So given a salt s and data d you'd just do the following to generate a salted hash of the data: import hashlib

Android, calculating SHA-1 hash from file, fastest algorithm

旧时模样 提交于 2019-12-03 02:22:54
I have a problem with SHA-1 performance on Android. In C# I get calculated hash in about 3s, same calculation for Android takes about 75s. I think the problem is in reading operation from file, but I'm not sure how to improve performance. Here's my hash generation method. private static String getSHA1FromFileContent(String filename) { try { MessageDigest digest = MessageDigest.getInstance("SHA-1"); //byte[] buffer = new byte[65536]; //created at start. InputStream fis = new FileInputStream(filename); int n = 0; while (n != -1) { n = fis.read(buffer); if (n > 0) { digest.update(buffer, 0, n); }

String SHA-512 Encoding: C# and JAVA result is different

两盒软妹~` 提交于 2019-12-03 00:24:41
Im trying to compare two different string encoded by sha512. But, result is different. It can be an encode problem i mean. I hope you can help me. This is my Java code: MessageDigest digest = java.security.MessageDigest.getInstance("SHA-512"); digest.update(MyString.getBytes()); byte messageDigest[] = digest.digest(); // Create Hex String StringBuffer hexString = new StringBuffer(); for (int i = 0; i < messageDigest.length; i++) { String h = Integer.toHexString(0xFF & messageDigest[i]); while (h.length() < 2) h = "0" + h; hexString.append(h); } return hexString.toString(); and, this is my C#

How to reverse SHA1 Encrypted text [duplicate]

橙三吉。 提交于 2019-12-02 23:45:24
问题 This question already has answers here : Is it possible to reverse a sha1? (9 answers) Closed 5 years ago . I have a requirement to reverse translate a SHA1 encrypted text to plain text. I need the Java Code to it. many forums say that it cant be done but i have found a link http://www.stringfunction.com/sha1-decrypter.html which does exactly the same. I have tested it. Now i need the algorithm to implement in Java. Please help!!! 回答1: It's plain impossible. SHA1, like all cryptographic