1

I am encrypting a string using Setup Factory:

string Crypto.BlowfishEncryptString ( 
  string Text,
  string Key,
  number LineLen = 0 )

Description:

Blowfish encrypts a string and returns a base64-encoded string containing the encrypted data.

Note: Base64 encoding is the process of encoding arbitrary data as plain ASCII text. One common use for this type of encoding is sending files through email. It is one of the techniques employed by the MIME standard to send data other than plain ASCII text.

I wrote this:

encryptedPass = Crypto.BlowfishEncryptString("password123", "uniqueKey", 0);

Which prints a base-64 string:

j5b+4W25ugGZxXJZ0HCFxw==

Now to decrypt the password, in C#:

Using the snippet available for .NET here.

string enKey = "uniqueKey";
string test = "j5b+4W25ugGZxXJZ0HCFxw==";

byte[] convertedByte = Encoding.Unicode.GetBytes(test);
string hex = BitConverter.ToString(convertedByte).Replace("-", string.Empty);

Blowfish algo = new Blowfish(enKey);
string decryptedTxt = algo.decryptString(hex);

But this returns null, I tried it without decoding the base-64 as well.

EDIT:

Tried decoding the base-64 string as well:

byte[] bytes = Convert.FromBase64String(test);
string hex = BitConverter.ToString(bytes).Replace("-", string.Empty);

Blowfish algo = new Blowfish(enKey);
string decryptedTxt = algo.decryptString(hex);
Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Jack
  • 11
  • 2
  • One of the comments on that project page says: *The encrypted output changes with each execution with the same inputs.* If that is true, this is a horrible implementation of Blowfish and you might want to search for another one. – dotNET May 06 '19 at 07:36
  • @dotNET That sounds horrible, but Im stuck with using this. Is there a way out? – Jack May 06 '19 at 07:39
  • Related question, they recomend a different blowfish implementation https://stackoverflow.com/questions/2681505/using-blowfish-encryption-within-net – Cleptus May 06 '19 at 07:39
  • @bradbury9 been there, done that. none worked. – Jack May 06 '19 at 07:41
  • A bad company has got two solutions: Change the company or leave the company. Your call! :) – dotNET May 06 '19 at 07:42
  • "_Im_ _stuck_ _with_ _using_ _this_" you are stuck using an unreliable code? Try other alternatives... – Cleptus May 06 '19 at 07:51

0 Answers0