I am quite new to Dart and I've trying to build an API in Dart. I am facing a problem with the hashing part, how can i get it to output 128 characters just like the method from python
I've tried using crypto and pointycastleThe packages output a hash of length less than 128 unlike the one from the Python one.
So what is the best way I can generate sha512 hashes of length 128 in Dart?
As part of authentication of a json response, I have used hashlib.hmac sha512 for hashing the json response using a secret_key. But was surprised to see that different versions in python returned different hashed values for the same json, secret_key. Could someone help me out regarding this issue?
I'm trying to duplicate the following python code in Erlang:
python -c "import random,string,crypt;print crypt.crypt('example', '\$6\$5H0QpwprRiJQR19Y\$')"OUTPUT: $6$5H0QpwprRiJQR19Y$B8EBtKxKU4Poxi.qLsL/t7uoriHX/cdnn9kT7kTsUIvwKPR6oJLOl8NAH8vPT.BNPdEY7a4.rz8YhziecWQ6I/
From reading online:
My current erlang code is below:
I've tried manipulating the return but can't get them to match.
With the same byte array, the result of performing a checksum using .NET Core 3.0's SHA512Managed class is different than the result of using the built-in shasum app in MacOS.
I've triple-checked the byte array is unmodified/identical by iterating over every byte position using File.ReadAllBytes().
Process in code:
var stream = asm.GetManifestResourceStream(resourceName);var data = new byte[stream.Length];stream.Read(data, 0, (int)stream.Length);var sha = new SHA512Managed();var checksum = sha.ComputeHash(data);
At the command line:
shasum -a512 ./myfile.dat
I'm receiving a good (expected) checksum value from the shasum utility, the iHex app from the AppStore, and the website "passwordsgenerator.net/sha512-hash-generator/".
I'm receiving a bad value from the .NET code above and from the a different website "online-convert.com". Both of which produce the identical bad result!
Is there more than one implementation of the SHA512 algorithm? Since I'm comparing byte arrays, there should be no nonsense involving character encoding, right? Is there something about compiling or reading back an embedded resource in MacOS I should know about?
Any tips or pointers would be greatly appreciated!
I've been investigating a bit about Java String encryption techniques and unfortunately I haven't find any good tutorial how to hash String with SHA-512 in Java; I read a few blogs about MD5 and Base64, but they are not as secure as I'd like to (actually, Base64 is not an encryption technique), so I prefer SHA-512.