I am using the react-native-sha512 package for hashing the text and trying to send the text to the backend after hashing it.Below is the piece of the code I am using to hash the text -
import { sha512 } from 'react-native-sha512';constructor(props){ this.state = {password: ""}}sha512("Test").then(hash => { this.setState({ password: hash })})this.props.login(username.toLowerCase(), this.state.password);
where Test
is the text I am trying to hash, but it is giving me the following error -
undefined is not an object(evaluating 'u.sha12')
Do I need to add anything else apart from the above piece of code for hashing?
Thank you in advance!
The maven-publish
plugin generates MD5 und SHA1 checksum files for all artifacts by default. But is there any way to make the plugin generate secure checksum files (SHA512 would be preferred)?
This is pretty easy to reproduce. I just initialized a new java-library
project and added the maven-publish
plugin and it's configuration
build.gradle:
apply plugin: 'java'apply plugin: 'maven-publish'repositories { jcenter()}dependencies {}publishing { repositories { maven { url rootProject.buildDir.path + '/repo' } } publications { mavenJava(MavenPublication) { groupId = 'org.gradle.sample' artifactId = 'project1-sample' version = '1.1' from components.java } }}
I already consulted the gradle documentation and javadoc, but was not able to find any hints on the checksum files at all. I know I can generate checksums for the artifacts pretty easily using the ANT checksum task like this
doLast { ant.checksum(file: archivePath, algorithm: "SHA-512")}
But I would somehow need to place them in the correct folder aside the actual artifacts "manually", which is something I'd like to avoid.
EDIT:
If it's not possible to specify the checksum algorithm, is it somehow possible to hook into the publish
task and add a custom checksum file to the artifact destination folders? I don't want add the checksum files themselves as artifacts as there would be MD5 and SHA1 checksums for the checksums, which makes no sense.
I am currently working on a new PHP site for a site currently utilizing ColdFusion 10. When the new site is ready the ColdFusion site will be decommissioned and I won't have access to anything related to ColdFusion. I don't want to have to reset all the previous passwords so need to be able to duplicate the one-way SHA-512 hash that is utilized in ColdFusion in PHP.
This question on Stack Overflow is very relevant to this problem:hash function that works identically on ColdFusion MX7 and PHP 5.x?
The difference is they manually looped in 1024 iterations in ColdFusion. The ColdFusion site I am translating uses the built in iterations feature. I have tried what they did in the above question, plus a few variations including XOR in the end but ultimately I can't find documentation on what ColdFusion is doing during those iterations.
ColdFusion:
<cfset hpswd = Hash(FORM.npswd & salt, "SHA-512", "UTF-8", 1000) >
PHP (without iterations logic):
$hpswd = strtoupper(hash("sha512", $npswd.$salt));
Given this password: q7+Z6Wp@&#hQ
With this salt: F4DD573A-EC09-0A78-61B5DA6CBDB39F36
ColdFusion gives this Hash (with 1000 iterations): 1FA341B135918B61CB165AA67B33D024CC8243C679F20967A690C159D1A48FACFA4C57C33DDDE3D64539BF4211C44C8D1B18C787917CD779B2777856438E4D21
Even with making sure to strtoupper with PHP I have not managed to duplicate the iterations step so the question, what operands is ColdFusion 10+ doing during the iterations step?
hopefully someone can help.
I have to update a user's details in a MySQL Drupal environment from a VB.NET application/ASP.
So the user changes their password using classic ASP, this calls a .COM compliant DLL Class written in VB.NET
The instructions I have found are: (located from this site)
Here is an example hash from Drupal 7:
"pass" : "$S$Dxl65W9p07LfQU7jvy5CnsyDpMoLujiAgzy123khcg1OJi/P9pKS"
The characters 0-2 are the type ( $S$ is Drupal 7 )
The character 3 is the number of log2 rounds (X) based on the position of the char in this list: './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' So in our example 'D' would map to 15The characters 4-11 are the SALTThe rest is a SHA512 hash using 2^X rounds.The binary result is then converted to a string using base64.
$count = 1 << $count_log2;$hash = hash($algo, $salt . $password, TRUE);do { $hash = hash($algo, $hash . $password, TRUE);} while (--$count);
Not being a cryptographer of any sort or understanding PHP, I found a bit of code that could do the SHA512 encryption and tried decyphering the PHP to VB.NET - I think this is what the PHP code above is doing, to encrypt a string.
Private Function EncryptSHA512Managed(ByVal ClearString As String) As String Dim uEncode As New UnicodeEncoding() Dim bytClearString() As Byte = uEncode.GetBytes(ClearString) Dim sha As New System.Security.Cryptography.SHA512Managed() Dim hash() As Byte = sha.ComputeHash(bytClearString) Dim Z as Integer = 0 For Z = 1 To HowManyTimes - 1 hash2 = sha.ComputeHash(hash) hash = hash2 Next Return Convert.ToBase64String(hash2) End Function
So from what I understand about the PHP explanation (and I have never used PHP) I would do something like this:
Private Function EncryptionStringForDrupal() As String Dim EncStr As String = "apassword" ' Going to use TestSale as my salt test. Return "$S$DTestSalt" & EncryptSHA512Managed("TestSalt" & EncStr) End Function
With The "D" in the example PHP text, thats 15^2 and it comes out as 32,768 encryption loops and the resulting drupal encrypted password comes out as
$S$DTestSaltTjmIXDexvVOnQDA4ojamH2PFxVrfIKJLJBKNtclZaxs/LHiF8Wxx2kMb03qeo+FUK7prxEiKfToY50ZG0SQ3QA==
But its still wrong -.-
I am trying to migrate a sha-512 computation from java to node JS and I can't seem to get the same results...
Java code (which looks standard from what I saw online):
public class Test{ private static String get_SecurePassword(String passwordToHash, String salt, String algo) throws NoSuchAlgorithmException { String generatedPassword = null; MessageDigest md = MessageDigest.getInstance(algo); md.update(salt.getBytes()); byte[] bytes = md.digest(passwordToHash.getBytes()); StringBuilder sb = new StringBuilder(); for (int i = 0; i< bytes.length; i++) { sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1)); } generatedPassword = sb.toString(); return generatedPassword; } public static void main(String[] args) throws NoSuchAlgorithmException { String res = get_SecurePassword("test", "test", "SHA-512"); System.out.println(res); }}
Output:
125d6d03b32c84d492747f79cf0bf6e179d287f341384eb5d6d3197525ad6be8e6df0116032935698f99a09e265073d1d6c32c274591bf1d0a20ad67cba921bc
NodeJS:
const crypto = require('crypto');function getSecurePassword(password, salt, algo) { const algoFormatted = algo.toLowerCase().replace('-', ''); const hash = crypto.createHmac(algoFormatted, salt); hash.update(password); const res = hash.digest('hex'); return res;}console.log(getSecurePassword('test', 'test', 'SHA-512'));
Output:
9ba1f63365a6caf66e46348f43cdef956015bea997adeb06e69007ee3ff517df10fc5eb860da3d43b82c2a040c931119d2dfc6d08e253742293a868cc2d82015
What am I doing wrong?
Note: I am using Java 8 and Node 10.13
Casa - Mapa del lloc - Intimitat - Enllaços - Copyright © 2019 Cortex IT Ltd : Contacte : admin @ cortexit.co.uk
Please note that by viewing our site you agree to our use of cookies (see Intimitat for details). You will only see this message once.