Questions tagged [sha1]

SHA-1 is a cryptographic hash function designed by the U.S. Government as a Federal Information Processing Standard. Recently, collisions have been detected, meaning that SHA1 is becoming more vulnerable to attacks, and its use for protecting data is not recommended.

sha1
Filter by
Sorted by
Tagged with
0 votes
1 answer
309 views

Encrypt data block with C/C++, platform independent

Say, if I have a byte array of a various length and a pass-phrase, what is the quickest way to encrypt it in a platform-independent way? PS. I can make a SHA1 digest on the pass-phrase but how do I ...
c00000fd's user avatar
  • 21.7k
0 votes
1 answer
4k views

What does (b & 0xff) mean? [duplicate]

With Java, I am converting a String value to a hash using SHA1 on a MessageDigest instance. I am at the point where I have created a hash object: MessageDigest md = MessageDigest.getInstance("SHA1"); ...
Jonny Stewart's user avatar
0 votes
2 answers
5k views

How to import md5 salt passwords from symfony to laravel 4

The user table from the old symfony system has the following columns: email | algorithm | salt | password --------------------+-------------+--------------...
Timothy's user avatar
  • 4,245
0 votes
1 answer
536 views

php form change sha1 password with sed and exec

I'm working on a simple password reset form, thanks to a great deal of help here I have something working. However I would like to add a twist and save the reset password in sha1. Here is my code: #...
jcrane's user avatar
  • 75
-1 votes
3 answers
4k views

Convert PHP to Python

I need help converting the following PHP to python $plaintext = "MyPassword"; $utf_text = mb_convert_encoding( $plaintext, 'UTF-16LE' ); $sha1_text = sha1( $utf_text, true ); $base64_text = ...
Mark's user avatar
  • 2,532
0 votes
1 answer
222 views

finger printing chunks using python

I am trying to chunk a file and create SHA1 finger prints for those chunks. Following is the code. My file is just having one line "tests" when I generate finger print from python command prompt I get ...
user avatar
3 votes
1 answer
6k views

is using sha1() with a salt secure?

I understand that sha1() is not secured, but my client's website uses something like this to hash passwords: $salt = '123abckkk'; $hash = sha1($salt.$password); Now I'm guessing that if someone ...
Sameer Zahid's user avatar
0 votes
2 answers
1k views

Are standard hash functions like MD5 or SHA1 quaranteed to be unique for small input (4 bytes)?

Scenario: I'm writing web service, that will act like identity provider for 3pty application. I have to send to this 3pty application some unique identifier of our user. In our database, unique user ...
Ondrej Svejdar's user avatar
1 vote
1 answer
179 views

Simulating MySql's PASSWORD() encryption using .NET in Windows 8

PASSWORD() according to MySQL documentation is a double SHA1 algorithm. In Win32 I was using this method: public string GenerateMySQLHash(string key) { byte[] keyArray = Encoding.UTF8.GetBytes(...
Ricardo's user avatar
  • 2,153
8 votes
2 answers
10k views

How to get correct SHA1 hash of BLOB using CryptoJS?

CryptoJS v3.1.2, sha1.js rollup In JS I want to calculate the SHA1 of a blob before sending it to the server. On the server I want to calculate the SHA1 of the resulting file and compare it to the ...
Val Kornea's user avatar
  • 4,507
3 votes
1 answer
527 views

Stateless incremental file hashing context resume

Question in short How can one "resume hash_context" in PHP? Background & Current Situation The software's goal is to receive big file chunk by chunk (synchronously), calculate both MD5 and SHA1 ...
George's user avatar
  • 1,456
12 votes
3 answers
21k views

How can I retrieve a salt from LDAP?

The organization that I work for uses PPolicy (an OpenLDAP module) to automatically salt and hash passwords. Unfortunately, I don't have access to the machine running the OpenLDAP server, so i can't ...
blkhp19's user avatar
  • 482
0 votes
1 answer
566 views

Match PHP's MD5 and SHA1 encoding with C#

I have a C# code that gets a hash of provided strings using either MD5 or SHA1 algorithm. It's not a problem in itself, but here it is for a reference: public static string GetMD5(Encoding encoding, ...
S_F's user avatar
  • 887
1 vote
1 answer
761 views

HashCode for a CSR

I have generated a P10 certificate and a Certification applicant document using a software(Dakota). The document contains a hash code. This hash code is supposed to be an SHA1 hash of the public key ...
DanMatlin's user avatar
  • 1,232
2 votes
1 answer
998 views

Using N first bits of a hash function to have an N-bit hash

I need a cryptographically secure hash function which would have similar properties that MD5 had, namely: 128-bit size and being fast. Since MD5 itself is quite broken nowadays, I'd like to use ...
dragonroot's user avatar
  • 5,751
0 votes
1 answer
299 views

Copy WordPress Password To Another Table With SHA1

How can I copy WordPress password to another table with SHA1? As per my knowledge WordPress using MD5 Currently I am using simple query something like INSEERT INTO rc_user(password) SELECT user_pass ...
RDev's user avatar
  • 35
6 votes
2 answers
3k views

Convert sha1 to bcrypt?

I have a PHP application that has a somewhat decent userbase. Now unfortunately, it has been using sha1($password . $salt) all these years and I really want to ditch that in favor of bcrypt. I have ...
Sayak Banerjee's user avatar
2 votes
2 answers
2k views

How to resolve a SHA1 hash mismatch?

Error: SHA1 mismatch Expected: 85f620a26aabf6a934c44ca40a9799af0952f863 Actual: db0e50d3ba8957eeb7879b1eaa03b0f004e121a7 Archive: /Library/Caches/Homebrew/cloog-0.18.0.tar.gz (To retry an ...
user2548662's user avatar
0 votes
1 answer
334 views

How can i know SHA-1 key of testkey in zipsigner app?

I have the source code of zip-signer application. I want to know the SHA-1 key of zip-signer application, how can I find it?
Shylendra's user avatar
2 votes
3 answers
3k views

Different in Java SHA1 vs JavaScript SHA1

I am a little bit confused. I want to get the bytes of an String, which is hashed with SHA1. JavaScript: var content = "somestring"; console.warn(content.getBytes().toString()); console.warn(...
Niklas's user avatar
  • 24.6k
107 votes
6 answers
195k views

Hashing with SHA1 Algorithm in C#

I want to hash given byte[] array with using SHA1 Algorithm with the use of SHA1Managed. The byte[] hash will come from unit test. Expected hash is 0d71ee4472658cd5874c5578410a9d8611fc9aef (case ...
Merve Kaya's user avatar
  • 1,229
8 votes
7 answers
14k views

Comparing images to find duplicates

I have a few (38000) picture/video files in a folder. Approximately 40% of these are duplicates which I'm trying to get rid of. My question is, how can I tell if 2 files are identical? So far I tried ...
spacitron's user avatar
  • 2,113
3 votes
1 answer
2k views

github, SHA-1 hash and git duplicates

I have a github repo which seems to have duplicate commits. Each commit has the same message string and the same date/author, but different SHA-1 hash sums. For example, in my log I found the ...
dermen's user avatar
  • 5,312
5 votes
3 answers
2k views

How can I replicate this C# hashing in PHP? (toByteArray(), ComputeHash())

I am trying to replicate the following code in PHP, It is example code for an API I have to interface with (The API & Example code is in C#, My app is in PHP 5.3). I'm not a C# developer and so am ...
user avatar
0 votes
2 answers
948 views

How best to use the encryption method for confirm code

How best to use the encryption method for confirm code on email notification: md5, sha1 or sha256 I make email notification for confirm some actions by email; I generated confirm code with salt and ...
frops's user avatar
  • 2,316
0 votes
2 answers
4k views

md5 to sha1 password hash changing

Basically I've got a game server in which had the password hash as sha1 and another as md5 for when new users registered an account. I decided to stick with sha1, however I want to be able for my ...
user2506542's user avatar
1 vote
1 answer
2k views

String to sha1, then to hexadecimal (length 40)

I want a string to sha1 encoding, then to hex, with a length of 40 characters. This is a Java webservice and the client side is to be done with PHP. Original code is Java (I don't have the source, ...
Edson Garrido's user avatar
3 votes
1 answer
99 views

SHA-1 not giving the same answer

I'm trying to implement SHA-1 on Android with the following code String name = "potato"; MessageDigest md = MessageDigest.getInstance("SHA-1"); md.update(name.getBytes("iso-8859-1"), 0 , name....
Dragons_Lair5's user avatar
1 vote
1 answer
963 views

Unable to load HMAC_SHA1 plugin

Running the Twitter Application in Perl and facing the above mentioned problem. The Perl is 5.8.8 and system is AIX with no root access. Code ./p_t.pl Error Unable to load HMAC_SHA1 plugin at ...
LonelySoul's user avatar
  • 1,212
7 votes
1 answer
7k views

Signing a string using a private key, RSA-SHA1 signature and than md5 it in Android

i need to sign a string using RSA-SHA1 signature and a private key from .PFX certificate. Here's my code: String rawString = "1234567890"; byte[] signed = null; FileInputStream cert = new ...
Draško's user avatar
  • 757
2 votes
2 answers
779 views

How to handle image filename duplication in scrapy image download

Scrapy uses sha1 to generate random image filename. When duplication occurs, it will overwrite the file, causing loss of an existing image file. Is it possible to write extra code (e.g: an overriding ...
Harry's user avatar
  • 570
3 votes
5 answers
3k views

Most efficient way to change the hash type of a password (md5 to sha1)

I have a system using MD5 to hash passwords from my users and store it into my database. Now, I'm changing to another system that uses SHA1 (and a unique system SALT, not user-unique) to hash the ...
Felipe Francisco's user avatar
3 votes
1 answer
5k views

How to compute SHA1 of an array in Linux kernel

I'm trying to compute SHA1 of an integer array in the Linux kernel. I have gone through crypto.c/crypto.h and security/integrity/ima/ima_crypto.c but I can't figure out how to init and then update the ...
recluze's user avatar
  • 1,940
0 votes
1 answer
754 views

SQL Server sha1 value in prepared statement gives a different value than hardcoded string

I am trying to encrypt a password in SQL Server and I'm getting two different results when I use a string vs. using a prepared statement parameter. For example: SELECT sys.fn_varbintohexstr(...
user2438154's user avatar
1 vote
1 answer
2k views

Get SHA1 checksum of byte array in JavaScript?

So I need to get a SHA1 hash of a byte array in javascript (Will be array of integer values 0-255), I can't seem to figure out how to achive this. I need to be able to get the same result as the C# ...
user1876122's user avatar
4 votes
1 answer
2k views

Why Javascript sha1 and PHP5 sha1 generate different result for utf-8 string?

I have a string which contains some utf-8 characters, like "abc艾", and found that php5 sha1 generate a different code compared with Javascript sha1, could anyone help me this out? Thanks in advance. ...
Wt Test's user avatar
  • 41
1 vote
1 answer
248 views

Wrong checksum on stacked writer & zlib.writer

I have two object writers, first one encapsulates io.Writer and along writes it also coputes SHA1 checksum of content, and second encapsulates first and writes zlib compressed data. My unit test case ...
canni's user avatar
  • 5,827
-1 votes
1 answer
392 views

WARNING: PACK(): IN xx ON LINE xxx [closed]

I am getting a warning from the pack function without any information. The string I am passing seems to be fine. Can anyone tell me what might be causing the issue? $s = trim(hash_hmac('sha1', trim($...
Paco's user avatar
  • 29
0 votes
1 answer
256 views

Is there an issue with putting a longer input string to a hashing algorithm than the algorithm outputs?

Currently I'm designing a hashing system for user emails, but what happens if the user email is longer than the hash output. I usually use sha1 sha256 or sha512 if it makes a difference based on ...
B Rad C's user avatar
  • 510
1 vote
1 answer
2k views

Capicom SHA1 hash gets computed different in Java

I am using CAPICOM assembly with VBS logic to encrypt some text, this works good but the problem starts when trying to replicate the same using Java. This is my VBS code: Option Explicit Dim ...
Oscar Jara's user avatar
  • 14.2k
2 votes
1 answer
4k views

Hash function SHA1 in C++ [duplicate]

I want to use SHA1 function from openssl library for hashing a string, I have downloaded the library and installed it in /usr/include, and here is my code: #include <openssl/sha.h> #include &...
user1995098's user avatar
0 votes
3 answers
390 views

C SHA1 hash not working

Trying to take a character arracy (new to C) and encode it in SHA1. The following bit of code is not working. As its returning '\x10' char encode[1000]; strcpy(encode, "GET\n\n\n"); strcat(encode, ...
Cmag's user avatar
  • 15.3k
1 vote
0 answers
517 views

Why is SHA1 hashing the same string differently?

This is the code I have to salt and hash a user's password when they register (with the actual password hashing taken out because it was hashing consistently). What is happening is that when I use the ...
Rahul Gupta-Iwasaki's user avatar
5 votes
2 answers
5k views

Ruby code for openssl to generate fingerprint

I need the ruby equivalent of the following: openssl x509 -sha1 -fingerprint -noout -in cert.pem The code that I wrote is: data = File.read("cert.pem") data["-----BEGIN CERTIFICATE-----\n"]="" data[...
Mukta's user avatar
  • 51
0 votes
4 answers
673 views

How to filter and recognise hash strings in PHP?

At the beginning of every php script, I loop through the possible POST and GET inputs, filter them properly, so later when I need an input, I can use my custom, safe, filtered variable, (which is an ...
Ágota Horváth's user avatar
2 votes
0 answers
2k views

Better algorithm for converting SHA1 to Ascii that uses fewer than 40 characters?

All conversions of the 160 bit SHA1 use 40 ascii characters (320 bits) to represent 160 bits of data (that I have been able to find). I have a need to optimize this and use as few ascii characters as ...
Matt Johnson's user avatar
  • 1,923
0 votes
1 answer
141 views

URLConnection Basic Authorization with hashed password

I want to open URLConnection to a page that use 'Basic' authentication (Digest method = SHA1). I only have the hashed password, how can I open the connection?
danieln's user avatar
  • 4,903
0 votes
2 answers
833 views

php sha1 does not match .Net sha1Managed

I am having problem in matching a SHA1 algorithm in PHP and C# .Net. I need to modify the PHP code to match with .Net value. The code in .Net is as following: DateTime dtNow = DateTime.parse("4/29/...
Saikat's user avatar
  • 1
0 votes
1 answer
950 views

.NET to Progress 4GL Cryptography

I have a VB.NET application I am trying to send encrypted information to a Progress 4GL 10.2B application. I have matched the Iteration Count, Salt, Private Key, and Initialization Vector. I cannot ...
Joseph D Surgeon's user avatar
2 votes
4 answers
9k views

Password Hashing, BCrypt to SHA1/MD5

I have been looking at upgrading the password hashing security of one of my applications as I have been reading up about brute force attacks being considerably faster then they used to. Currently I am ...
Ozzy's user avatar
  • 10.5k

1
22 23
24
25 26
37