sha1

Is SHA sufficient for checking file duplication? (sha1_file in PHP)

微笑、不失礼 提交于 2019-12-07 01:51:52
问题 Suppose you wanted to make a file hosting site for people to upload their files and send a link to their friends to retrieve it later and you want to insure files are duplicated where we store them, is PHP's sha1_file good enough for the task? Is there any reason to not use md5_file instead? For the frontend, it'll be obscured using the original file name store in a database but some additional concerns would be if this would reveal anything about the original poster. Does a file inherit any

PHP SSL Certificate Fingerprint

天大地大妈咪最大 提交于 2019-12-07 01:07:26
问题 I need display in web page fingerprints of SSL Certificate. Is it possible in PHP? The function openssl_x509_parse doesn't return SHA1 and MD5 fingerprints. How resolve this problem? Thanks. 回答1: I'd guess the easiest way is going to be to call openssl through system $fingerprint = str_replace("SHA1 Fingerprint=", '', system('openssl x509 -noout -in /path/to/your/cert.pem -fingerprint')); And yes, I know, this is nothing like a clean way of doing this - however, it's the only one I can think

Google Cloud Messaging: How to use SHA1 certificate?

99封情书 提交于 2019-12-06 15:09:15
I have a doubt. I developed an Android App which receives push notifications via Google Cloud Messaging. Here are the steps I took: Creation of new Project on Google Developer console and copy/paste my Project Number in my android app. Registration of my App through RegID previously received by Google Cloud Messaging. Result: Ok! My App appears in database on my server. Copying/paste Api Key in my Server. I obtained my Api Key from Google Developer Console (Projcet/API/Credential/New API Key) creating new API Key without putting any SHA1 certificate. I exported my application (I use Android

Can I serialize a ruby Digest::SHA1 instance object?

大憨熊 提交于 2019-12-06 12:46:19
G'day people, I am re-implementing an existent custom file upload service in ruby (sinatra) with redis as a backing store. Client calculates a SHA1 hash and initiates an upload uploads max 64K chunks until finished Server appends chunks to file calculates SHA1 hash of complete file to verify correct receipt Now, what I am hoping to do is use ruby (1.9.3) Digest::SHA1 << (update) operator on each chunk, (rather than having to read the ENTIRE file from scratch at the end). [Large files > 1GB]. Unfortunately Digest::SHA1 and Marshal.dump aren't compatible 1.9.3p125 :001 > require 'digest' => true

How to set MessageDigest seed?

你说的曾经没有我的故事 提交于 2019-12-06 12:01:51
The MessageDigest class implements the SHA-1 algorithm (among many others). The SHA-1 algorithm allows one to use different "seeds" or initial digests. See SHA-1 Psuedocode The algorithm initializes variables, or the seed: Initialize variables: h0 = 0x67452301 h1 = 0xEFCDAB89 h2 = 0x98BADCFE h3 = 0x10325476 h4 = 0xC3D2E1F0 However the MessageDigest class, as described in the Online Java Manual , provides no API for setting these initial variables. In fact, it doesn't state the value of the initial variables. How can I set the initial seed for the SHA-1 algorithm? Where is an example of SHA-1

Different in Java SHA1 vs JavaScript SHA1

一个人想着一个人 提交于 2019-12-06 11:54:44
问题 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(CryptoJS.SHA1(content.getBytes().toString()).toString().getBytes()); String.prototype.getBytes = function () { var bytes = []; for (var i = 0; i < this.length; i++){ bytes.push(this.charCodeAt(i)); } return bytes; }; Array.prototype.toString = function(){ var result = ""; for(var i = 0; i < this.length; i

If you know the length of a string and apply a SHA1 hash to it, can you unhash it?

可紊 提交于 2019-12-06 11:37:21
Just wondering if knowing the original string length means that you can better unlash a SHA1 encryption. No, not in the general case: a hash function is not an encryption function and it is not designed to be reversible. It is usually impossible to recover the original hash for certain. This is because the domain size of a hash function is larger than the range of the function. For SHA-1 the domain is unbounded but the range is 160bits. That means that, by the Pigeonhole principle , multiple values in the domain map to the same value in the range. When such two values map to the same hash, it

How to easily apply Crypto++ hash functions?

冷暖自知 提交于 2019-12-06 11:37:16
Can someone help me how can I easily use hash functions from Crypto++ library? I tried used these codes for SHA1 and MD5. I have many errors on line where is StringSink . The errors are like: undefined reference to `CryptoPP::StringSinkTemplate::StringSinkTemplate(std::string&)' Thanks for help. // SHA CryptoPP::SHA1 sha1; std::string source = "Hello"; std::string hash = ""; CryptoPP::StringSource(source, true, new CryptoPP::HashFilter(sha1, new CryptoPP::HexEncoder(new CryptoPP::StringSink(hash)))); std::cout << hash; // MD5 CryptoPP::MD5 hash; byte digest[ CryptoPP::MD5::DIGESTSIZE ]; std:

Certificate fingerprint is invalid?

穿精又带淫゛_ 提交于 2019-12-06 06:39:32
问题 I have generated my SHA1 code from my keystore but when I try to create an OAuth client 2.0, Google game console is giving me the error: "Certificate fingerprint is invalid". Anyone knows why this happens? How do I fix this? 回答1: I've contacted Google Play Developer Support about this issue (I've got a same problem). Here is their answer : Please ensure the key is set to 2048 bit and is valid for at least 25 years. I've tried it, but sadly my debug.keystore is still not getting accepted,

SHA1 Hash on Hex String

不羁的心 提交于 2019-12-06 06:36:27
问题 I'm trying to hash a number, represented by hex string with Java security library. Meaning, If I have the String "AABBCCDD" I want to hash it not as this is an ascii input, which is 0x65, 0x65, 0x66, 0x66, 0x67, 0x67, 0x68, 0x68, but as four bytes - 0xAA, 0xBB, 0xCC, 0xDD. I managed to do it with low values such as "112233445566" (since bytes are signed in Java) but failed with high values. Does someone know how to implement such thing? Thanks, Binyamin 回答1: First convert your hex into byte[]