sha

Looking for Signing algorithm that creates 32 or 16 byte keys in Java

无人久伴 提交于 2019-12-11 18:34:59
问题 Cannot match up the size of key generated using public/private keys for licensing application. Ive written a self contained example that creates public/private key, create a license by signing user emailaddress with public key, and then check using public key, license and email address that the license indeed was encoded using private key (Obviously this wouldn't all be in one class usually). This all works but the hex version of the license key is 96 characters (i.e representing 48 bytes/384

Padding the message in SHA256

落花浮王杯 提交于 2019-12-11 12:16:45
问题 I am trying to understand SHA256. On the Wikipedia page it says: append the bit '1' to the message append k bits '0', where k is the minimum number >= 0 such that the resulting message length (modulo 512 in bits) is 448. append length of message (without the '1' bit or padding), in bits, as 64-bit big-endian integer (this will make the entire post-processed length a multiple of 512 bits) So if my message is 01100001 01100010 01100011 I would first add a 1 to get 01100001 01100010 01100011 1

Verification of Hashing password is not working

送分小仙女□ 提交于 2019-12-11 11:11:42
问题 I have asked a question of which I did get a lot of great feedback, along with a good answer. I assume that I am doing something wrong with my verification check of the 2 hashes. Perhaps the code in the loop is fine, but my code with understanding of bytes and base64 etc. is the problem? Here is the original question. Password Hashing - Why salt 60,000 times Problem is these hashes do not match if (resultHash.Equals(hashPassword)) Code public string BuildVerify() { string password = "";

When using SHA-256 hashes as a primary key, is it OK to ignore the possibility of collisions? [duplicate]

落爺英雄遲暮 提交于 2019-12-11 09:38:13
问题 This question already has answers here : Is it safe to ignore the possibility of SHA collisions in practice? (3 answers) Closed 5 years ago . I have this situation where I have files on the HDD and I want to cache information about them in a database. Information that would otherwise take a long time to parse given that some of these files can run into GBs. My first intuition is to use the file path as a unique identifier for a file and I use that as the key (TEXT/VARCHAR) and store the

Get the SHA-512 of any SQL query

百般思念 提交于 2019-12-11 06:55:17
问题 A common practice to compare two text file is to use the SHA-512 [or any other realted SHA algo]. If two SHA results are not the same then the files are not exactely the same. I would like to do the same with two SQL queries. I just want to know if the queries gives 100% identical result or not with a SHA-512 [or sha-256 would be OK as well]? Is that possible to perform that? I am using SQL Server... 回答1: Just to help... It's understood that both queries return the same columns in the same

I want to convert 160-bit to integer

倾然丶 夕夏残阳落幕 提交于 2019-12-11 05:35:31
问题 I am using SHA1 so i want to convert the output of this SHA1 to integer 回答1: How about echo preg_replace("/[^0-9]/i", "", sha1("apikot")); 回答2: You could represent 160 bits in 5 long ints. That could be an array of 5 long ints, or you could have it be an array of 10 short ints. Are you trying to make it easier to handle than a string of characters/bits? 回答3: This will convert the sha1sum of /tmp/a to a decimal integer: $ (echo ibase=16; (cat /tmp/a | sha1sum | tr a-z A-Z | sed s/-// )) | bc

Spring LDAP - How to manage encoded (SHA) password

瘦欲@ 提交于 2019-12-11 04:08:26
问题 I want to implement a basic user repository using Spring LDAP and it's concept of Object-Directory Mapping (ODM). My User class is pretty straightforward : @Entry(objectClasses = { "inetOrgPerson", "organizationalPerson", "person", "shadowAccount", "top" }, base = "ou=people") public class User { [...] @Id private Name dn; @Attribute(name = "uid") @DnAttribute(value = "uid") private String username; @Attribute(name = "cn") private String fullName; @Attribute(name = "givenName") private String

libgit2sharp what is correct sha to supply to GitHub API merge pull-request?

青春壹個敷衍的年華 提交于 2019-12-11 03:46:31
问题 GitHub API requires merge pull-request to be submitted as PUT /repos/:owner/:repo/pulls/:number/merge with request body json { "commit_message": "blah", "sha": "{SHA that pull request head must match to allow merge}", } Following a commit, push, create PR, what libgit2sharp property supplies the correct sha ? For the current branch, it appears Branch.Tip.Sha is the correct value, but I'm receiving response error : { "message": "Head branch was modified. Review and try the merge again.",

How to Hex Encode a SHA-256 Hash

ε祈祈猫儿з 提交于 2019-12-11 03:25:12
问题 How to Hex Encode a SHA-256 hash properly in C#? private static string ToHex(byte[] bytes, bool upperCase) { StringBuilder result = new StringBuilder(bytes.Length * 2); for (int i = 0; i < bytes.Length; i++) result.Append(bytes[i].ToString(upperCase ? "X2" : "x2")); return result.ToString(); } private string hashRequestBody(string reqBody) { string hashString; using (var sha256 = SHA256Managed.Create()) { var hash = sha256.ComputeHash(Encoding.Default.GetBytes(reqBody)); hashString = ToHex

SQL Server 2005 hashbytes(‘sha1’,'code') alternative in MySQL

岁酱吖の 提交于 2019-12-11 03:13:59
问题 Hi i have several passwords encrypted in this way: hashbytes(‘sha1’,'password') Using SQL Server 2005, we are planing a migration to MySQL. There is a hash function equivalent in MySQL or PHP. Because i use a standard SHA1 algorithm and results are different that the ones i have using SQL Server algorithm. 回答1: I found out that php uses ascii encoding, so in order to get the same results in sql server management studio for example, use a varchar(8000) as @input. 回答2: MySQL has a SHA1 function