topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday April 25, 2024, 10:47 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - McDeffice [ switch to compact view ]

Pages: [1]
1
Mircryption / Re: mircryption for NodeJS
« on: May 25, 2020, 02:54 PM »
up

2
Mircryption / Re: mircryption for NodeJS
« on: April 04, 2020, 01:51 PM »
My test CBC MODE

// Blowfish CBC code
const Blowfish = require('egoroof-blowfish');

const ircPrefix = "+OK *";
const IV = '00000000';

function generateIV() {
   const left = Math.random().toString(36).substring(2, 6);
   const right = Math.random().toString(36).substring(2, 6);
   return left + right;
}

function encode(str) {
  const textToEncode = generateIV() + str;
  const encodedString = Buffer.from(blowfish.encode(textToEncode)).toString('base64');
  return ircPrefix + encodedString;
}

function decode(str) {
  const cleanText = str.substring(ircPrefix.length)
  const data = Buffer.from(cleanText, 'base64');
  const decoded = blowfish.decode(data, Blowfish.TYPE.UINT8_ARRAY);
  const decrypt = Buffer.from(decoded).slice(8).toString('utf8');
  return decrypt;
}

var test_key = 'test123';
const blowfish = new Blowfish(test_key, Blowfish.MODE.CBC, Blowfish.PADDING.PKCS5);
blowfish.setIv(IV);

// Testing code

var test_text = 'test';
console.log('text: ' + test_text);
const encoded = encode(test_text);
console.log('encoded: ' + encoded);
console.log('decoded: ' + decode(encoded));

No one is interested in the topic? Any help is welcome ! tks

3
Mircryption / Re: mircryption for NodeJS
« on: March 31, 2020, 12:35 PM »
i would like to use to encrypt and decrypt IRC messages via an IRC bot in NodeJS. This message uses CBC or ECB blowfish mircryption using block and base64 encryption.

I find information here:
Blowfish plugins for IRC seem to use the MODE_ECB (electronic code book), which is probably the least secure of the blowfish algorithms.

For encryption, they break the plaintext up into 8-byte chunks (the Blowfish ECB blocksize). They then encrypt each 8-byte block separately, and take the output of each encrypted block, and chunk that into (2) 4-byte longs, and base64encode each long, padding them to length of 6 base64 characters.

For decryption, this process is reversed, but because it's somewhat confusing I'll also describe that. Take 12 of the ciphertext bytes, decoding each 6-byte representation as a long ('>L'), so that you now have 8 bytes, which you then pass to the blowfish decryption algo.

Source : IRC blowfish encryption mode?
- Block_cipher_mode_of_operation
- Java Code example

what I found closest to javascript is here:
- javascript-blowfish package
- egoroof-blowfish package

tks!

EDIT :
The data transmitted by FiSH is not standard Base64. It uses a nonstandard encoding table which you'll have to account for.



4
Mircryption / mircryption for NodeJS
« on: March 28, 2020, 02:11 PM »
I would like to use mircryption with NodeJS, I did not find anything about it.

Can you help me with my quests? tks

Pages: [1]