cryptography

128 bit hash without collisions guaranteed

微笑、不失礼 提交于 2020-03-03 12:49:21
问题 Is there a 128 hashing algorithm (no matter if it is a crypto or non-crypto hashing) that guarantee no collision could occur? If can guarantee my string would not exceed a specific length (is there such length? - I can guarantee a length less than 100 chars) Thanks, J.B 回答1: No you can't make such an algorithm. If you have a string with 100 characters, you have (let character be in 1..255 range) 256**100 == (2**8)**100 == 2**800 different strings (pontential collisions); 128 bit hash function

128 bit hash without collisions guaranteed

江枫思渺然 提交于 2020-03-03 12:48:07
问题 Is there a 128 hashing algorithm (no matter if it is a crypto or non-crypto hashing) that guarantee no collision could occur? If can guarantee my string would not exceed a specific length (is there such length? - I can guarantee a length less than 100 chars) Thanks, J.B 回答1: No you can't make such an algorithm. If you have a string with 100 characters, you have (let character be in 1..255 range) 256**100 == (2**8)**100 == 2**800 different strings (pontential collisions); 128 bit hash function

Are the odds of a cryptographically secure random number generator generating the same uuid small enough that you do not need to check for uniqueness?

故事扮演 提交于 2020-03-03 07:45:08
问题 I'm using this with a length of 20 for uuid. Is it common practice to not check if the uuid generated has not been used already if it's used for a persistent unique value? Or is it best practice to verify it's not already being used by some part of your application if it's essential to retain uniqueness. 回答1: You can calculate the probability of a collision using this formula from Wikipedia:: where n ( p ; H ) is the smallest number of samples you have to choose in order to find a collision

Encrypting sensivite data in React Native and Expo

痞子三分冷 提交于 2020-02-29 17:52:11
问题 I`m working on mobile app with React Native and Expo, providing security solutions. Project owner want to store in app sensitive authorization keys, used to contact with REST server and access to secured data. He demand to have this keys at least encrypted, and hard to read from outside as much as possible. I know about topis: Save sensitive data in React Native Is React Native's Async Storage secure? and about KeyChain , but they dont cover encyption and expo issues. So with is the best and

Java 1.6 + BouncyCastle + TLS1.2 (handshake_failure(40))

安稳与你 提交于 2020-02-29 03:41:28
问题 In my case, I have Java 1.6 and want to connect to a remote server which only supports TLS1.2. Server URL is: https://blagajne-test.fu.gov.si:9002 and certificate public key is here: http://datoteke.durs.gov.si/dpr/files/test-tls.cer I have no possibility to upgrade Java because is a part of Oracle Database 11g (11.4). I tried to write a simple program in Java which uses BouncyCastel libraries but got error: Exception in thread "main" org.bouncycastle.crypto.tls.TlsFatalAlertReceived:

Encryption with single key and decryption with multiple keys

强颜欢笑 提交于 2020-02-25 04:15:19
问题 I am searching for a mechanism which encrypt using single key. but for decryption it require multiple keys 2,3,4 and 5. Note that I want all (2,3,4 and 5) keys need to decrypt. I want to implement it in python. but i couldn't found concrete material online. I found answer encryption/decryption with multiple keys according to it i can use GnuPG for this purpose. I read GnuPG but i couldn't able to find answer to it. I found Shamir's Secret Sharing I believe it could solve my problem. But i

How to store secretkey in Android securely?

左心房为你撑大大i 提交于 2020-02-22 06:28:45
问题 I'm reading about store a secretkey (to encrypt/to decrypt data) and seems there is no way achieve that. One can only increase difficult for an attacker accomplish this. It's really like that? What I've got so far: Store in shared preference ( private mode ) - Rooted phone will be able to retrieve it. NDK C/C++ native code, create .so file - Hard to decompile, but one could call this .so file and retrieve it. A webserver to store the key, looks useless, if a have to send credentials, a

How to store secretkey in Android securely?

被刻印的时光 ゝ 提交于 2020-02-22 06:28:32
问题 I'm reading about store a secretkey (to encrypt/to decrypt data) and seems there is no way achieve that. One can only increase difficult for an attacker accomplish this. It's really like that? What I've got so far: Store in shared preference ( private mode ) - Rooted phone will be able to retrieve it. NDK C/C++ native code, create .so file - Hard to decompile, but one could call this .so file and retrieve it. A webserver to store the key, looks useless, if a have to send credentials, a

Git is moving to new hashing algorithm SHA-256 but why git community settled on SHA‑256

醉酒当歌 提交于 2020-02-20 11:17:25
问题 I just learned from this HN-post that git is moving to new hashing algorithm ( from SHA-1 to SHA-256 ) I wanted to know what makes SHA-256 best fit for git's use case. Is there any/many strong technical reason or is it possible that SHA-256 popularity is a strong factor ? ( I am making a guess ) Looking at https://en.wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions page I see thee are many modern and older alternatives present. some of them are more ( almost same if not more )

How can I decrypt a file in C# which has been encrypted by des.exe?

和自甴很熟 提交于 2020-02-20 09:29:39
问题 I have a file which has been encrypted by des.exe. A file can be encrypted and decrypted using the following commands: des -E -k "foo" sample.txt sample.txt.enc des -D -k "foo" sample.txt.enc sample.txt.dec I have attempted to decrypt using the following: public byte[] Decrypt(FileInfo file, string key) { byte[] keyAsBytes = LibDesPasswordConvertor.PasswordToKey(key); byte[] initializationVector = keyAsBytes; var cryptoProvider = new DESCryptoServiceProvider(); cryptoProvider.Mode =