sha

How do I convert password hashing from MD5 to SHA?

此生再无相见时 提交于 2019-11-29 02:32:04
问题 I've got an old application that has user passwords stored in the database with an MD5 hash. I'd like to replace this with something in the SHA-2 family. I've thought of two possible ways to accomplish this, but both seem rather clunky. 1) Add a boolean "flag" field. The first time the user authenticates after this, replace the MD5 password hash with the SHA password hash, and set the flag. I can then check the flag to see whether the password hash has been converted. 2) Add a second password

Are there in x86 any instructions to accelerate SHA (SHA1/2/256/512) encoding?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 01:25:39
An example, in x86 are Instruction Set to hardware acceleration AES . But are there in x86 any instructions to accelerate SHA (SHA1/2/256/512) encoding, and what library is the fastet to encoding SHA on x86? jww Are there in x86 any instructions to accelerate SHA (SHA1/2/256/512) encoding? It's November 2016 and the answer is finally Yes. But its only SHA-1 and SHA-256 (and by extension, SHA-224). Intel CPUs with SHA extensions hit the market recently. It looks like processors which support it are Goldmont microarchitecture : Pentium J4205 (desktop) Pentium N4200 (mobile) Celeron J3455

Compute SHA256 Hash in Android/Java and C#

情到浓时终转凉″ 提交于 2019-11-28 19:09:36
I am trying to generate a SHA256 hash in android, that I then pass to an ASP.NET Web API web service and compare the hash there. As such, I need to construct a hash in Android, that given the same inputs in ASP.NET will generate an equivalent hash. I'm pulling my hair out trying to figure out what I'm doing wrong. Here's the Android code: public String computeHash(String input) throws NoSuchAlgorithmException{ MessageDigest digest = MessageDigest.getInstance("SHA-256"); digest.reset(); try{ digest.update(input.getBytes("UTF-8")); } catch (UnsupportedEncodingException e){ e.printStackTrace(); }

How can I calculate the SHA-256 hash of a string in Android?

心不动则不痛 提交于 2019-11-28 16:49:18
I'm trying to get the SHA256 of a string in Android. Here is the PHP code that I want to match: echo bin2hex(mhash(MHASH_SHA256,"asdf")); //outputs "f0e4c2f76c58916ec258f246851bea091d14d4247a2fc3e18694461b1816e13b" Now, in Java, I'm trying to do the following: String password="asdf" MessageDigest digest=null; try { digest = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } digest.reset(); try { Log.i("Eamorr",digest.digest(password.getBytes("UTF-8")).toString()); } catch (UnsupportedEncodingException e) { //

How does SHA generate unique codes for big files in git

不问归期 提交于 2019-11-28 13:06:15
问题 Using Git I don't understand how using SHA you can generate just a 40 hexadecimal digit code that can then be mapped to any file which could be hundreds of lines long. The way I'm thinking of it, lets say the string '1' -> 00...01, the string '2' -> 00..02, the string 'a34ed..fc' -> a34ed..fc etc so the hash map is returning itself then it's clear that all the hash codes get used up very quickly and any string 41 characters long will be reusing one of the codes. Also I know it's known that

matlab学习——05插值和拟合(黄河小浪底调水调沙问题)

大憨熊 提交于 2019-11-28 10:25:45
05插值和拟合 黄河小浪底调水调沙问题 data3.txt 1800 1900 2100 2200 2300 2400 2500 2600 2650 2700 2720 2650 32 60 75 85 90 98 100 102 108 112 115 116 2600 2500 2300 2200 2000 1850 1820 1800 1750 1500 1000 900 118 120 118 105 80 60 50 30 26 20 8 5 插值 % 问题一 % v:水流量S:含沙量;V:排沙量? % 假设水流量和含沙量都是连续的,某一时刻的排沙量V=v(t)S(t) % 先已知某些时刻的 水流量 和 含沙量 ,给出估计任意时刻的 排沙量 及 总排沙量 % 总排沙量 是对 排沙量 做 积分 % 时间8:00-20:00 t1=28800,t24=1022400=t2 format compact; clc,clear; load data3.txt liu = data3([1,3],:); liu=liu';liu=liu(:); % 提出水流量并按照顺序变成列向量 sha = data3([2,4],:); sha=sha';sha=sha(:); % 提出含沙量并按照顺序变成列向量 y=sha.*liu;y=y'; % 计算排沙量,变成行向量 i=1:24; t=

Why does git commit --amend change the hash even if I don't make any changes?

孤人 提交于 2019-11-28 09:38:30
Why does the SHA-1 hash of my latest commit change even if I don't make any changes to the commit (message, files) after running git commit --amend ? Say I run the following at the command line. cd ~/Desktop mkdir test_amend cd test_amend git init echo 'foo' > test.txt git add test.txt git commit -m 'initial commit' Then, invoking git log --pretty=oneline --abbrev-commit prints the following message: b96a901 initial commit I then do git commit --amend but I change my mind and decide not to change anything in the last commit. In other words, I leave the files, directories, and message of the

Suppress Firefox/Firebug SHA-1 warning

夙愿已清 提交于 2019-11-28 07:08:42
I use Firebug for web development. Since version Firefox 37 I see the following annoying message in my console: This site makes use of a SHA-1 Certificate; it's recommended you use certificates with signature algorithms that use hash functions stronger than SHA-1" I understand that it is an important message, but it is duplicated many times and makes my work almost impossible. Moreover, it appears every time my page communicates with other pages, for example with Google Analytics and other counters. So if I were to update my certificate, this message would still appear because these sites

SHA2 password hashing in java

一笑奈何 提交于 2019-11-28 06:34:41
I'm trying to hash some passwords with SHA2. Where can I get a snippet of java code for make that? I have seen that post but I have something missing: SHA2 password storage with Java Mac mac = Mac.getInstance("HmacSha256"); SecretKeySpec secret = new SecretKeySpec(key.getBytes(), "HmacSha256"); mac.init(secret); byte[] shaDigest = mac.doFinal(phrase.getBytes()); String hash = ""; for(byte b:shaDigest) { hash += String.format("%02x",b); } The phrase is the String I want encode right? And what is the key (line 2) Thanks in advance First, you need to be clear what it is you want to do. You say

Creating user with encrypted password in PostgreSQL

十年热恋 提交于 2019-11-28 04:51:56
Is it possible to create a user in PostgreSQL without providing the plain text password (ideally, I would like to be able to create a user providing only its password crypted with sha-256) ? What I would like to do is to create a user with something like that : CREATE USER "martin" WITH PASSWORD '$6$kH3l2bj8iT$KKrTAKDF4OoE7w.oy(...)BPwcTBN/V42hqE.'; Is there some way to do that ? Thank you for your help. You may provide the password already hashed with md5 , as said in the doc ( CREATE ROLE ): ENCRYPTED UNENCRYPTED These key words control whether the password is stored encrypted in the system