blowfish

Encryption with BlowFish in Java

本秂侑毒 提交于 2019-12-29 03:22:47
问题 Following code works fine for me to encrypt a string with the BlowFish encryption. // create a key generator based upon the Blowfish cipher KeyGenerator keygenerator = KeyGenerator.getInstance("Blowfish"); // create a key SecretKey secretkey = keygenerator.generateKey(); // create a cipher based upon Blowfish Cipher cipher = Cipher.getInstance("Blowfish"); // initialise cipher to with secret key cipher.init(Cipher.ENCRYPT_MODE, secretkey); // get the text to encrypt String inputText =

decrypt value from blowfish in Objective-C code

余生长醉 提交于 2019-12-28 04:27:11
问题 I am recieving the Encrypted data by server (BLOWFISH ALGORITHM) , I have to decrypt it by using blowfish algorithm in IOS. you can donwload my code from here : https://www.dropbox.com/s/nswsm7des7isgd5/BlowfishTest-4.zip I am struggling from 2 days with this task , I try lot of links and find few useful : Blowfish Source code How to implement Blowfish algorithm in iOS http://www.codeding.com/articles/blowfish-encryption-algorithm-for-iphone In third link, i got ECB ( I have to decrypt using

BouncyCastle BlowFish Crypto issue

倾然丶 夕夏残阳落幕 提交于 2019-12-26 03:46:57
问题 here is my BlowFishCrypto Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Modes; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Math; namespace Common.Encryption { public class BlowfishCryptographer { private bool forEncryption; private IBufferedCipher cipher; public BlowfishCryptographer(bool forEncryption) { this.forEncryption =

How can I convert a Blowfish encoded binary string to ASCII in Ruby?

徘徊边缘 提交于 2019-12-25 04:32:18
问题 I would like to encode some plain text using Ruby and the Crypt library. I would like to then transmit this encrypted text (along with some other data) as an ASCII hexadecimal string within an XML file. I have the following code snippet: require 'rubygems' require 'crypt/blowfish' plain = "This is the plain text" puts plain blowfish = Crypt::Blowfish.new("A key up to 56 bytes long") enc = blowfish.encrypt_block(plain) puts enc Which outputs: This is the plain text ????; I believe I need to

Using Openssl blowfish encryption algorithm in C++

落爺英雄遲暮 提交于 2019-12-25 03:59:10
问题 I am writing code to encrypt the passwords and match encypted password to check if the passwords are weak. I have written encryption code using ECB mode API and it is not working as expected. There are few of the questions I am coming to while debugging my code. The only option I see, I can use is BF_ecb_encrypt. 1) ecb mode works on 8bytes at a time. What if my password has less than 8 characters? should it be padded randomly generated char? or with Zero's? Will it work this way? or any

Ruby blowfish difference in the last digits

a 夏天 提交于 2019-12-25 02:23:04
问题 I have some testdata key/text/encrypted from an API provider and am now trying to yield the same encrypted result with the function below, but my result diverts from the provided one in the last 16 of 241 digits. Do you have an idea, what the reason may be? I ensured, that 'bf-ecb' is the right mode, and experimented with url-encoding, but so far without success. require 'openssl' def encrypt(key, data) cipher = OpenSSL::Cipher::Cipher.new('bf-ecb').send(:encrypt) cipher.key = key result =

How to use blowfish in C++ as an external dll in C#

て烟熏妆下的殇ゞ 提交于 2019-12-24 23:25:05
问题 It seems there's no blowfish in C# that would do the same as this one.So I decided to use it as an external and if it doesnt work again then translate the whole blowfish in C#. But first I'll try to use as an external. Could you take a look at the C++ blowfish and tell me if I have to change the function parameters(some of them are LPBYTE,which is not included in C#). Also,I'd be thankful if you tell me how to use them as an external dll(I have it compiled as a dll already),but the function

48-bit blowfish

◇◆丶佛笑我妖孽 提交于 2019-12-24 12:12:45
问题 Is there an implementation (Java/C++/Ruby) of a Blowfish algorithm that supports 48-bit data blocks? I have an encryption problem where the input and output channels are exactly 48-bits. All implementations on the net are for 64-bit blocks. 回答1: That's because Blowfish has a set block size of 64-bits. You could pad two random bytes to the end of your data. require 'rubygems' require 'crypt/blowfish' blowfish = Crypt::Blowfish.new("A key up to 56 bytes long") plain="123456" encryptedBlock =

Using crypt, and verifying - not sure how it works?

时光总嘲笑我的痴心妄想 提交于 2019-12-24 08:57:50
问题 This is actually two questions: 1) My understanding is you determine what type of encryption crypt() uses by how many characters you use in the salt. For instance: crypt('mypassword', someStringThatIs33CharsLong); // This would be blowfish? 2) Once I get this data, how do I verify it against user input at a future date? The following doesn't appear to work: if (crypt($user_input, $encryptedinfo) == $encryptedinfo) { echo "Password verified!"; } What am I missing here? 回答1: When you are using

Blowfish crypto messes up first 8 bytes during encryption and decryption

心不动则不痛 提交于 2019-12-24 05:06:26
问题 I just tried out some en-/decryption with the openssl c librarys blowfish algorithm and ran into an odd error: the first 64 bits of the decrypted message are somehow messed up. What am I doing wrong? Here is the code: #include <openssl/blowfish.h> #include <cstring> #include <cstdio> int main() { unsigned char rawKey[] = "password"; BF_KEY key; BF_set_key(&key, strlen((char*) rawKey), rawKey); unsigned char msg[] = "Lorem ipsum dolor sit amet"; unsigned char enc[64]; memset(enc, 0, 64);