You are visiting the site as a unregistered user. You can earn points and a new level by registering. Register free for ever!
logo Televistar

Profile Picture
  • Name: One Person Email Verified
  • Public Username: Chess player
  • Bio: https://lichess.org/@/Quantium
  • Contact Me
New cryptocurrency!

Time To Read: 6 minutes or less

First and the most important thing in cryptohashing is encoding and decoding.
Today, in this part of this blog I'll tell about 3 types of encoders.
First type. "NO-KEYS"
It's a encoder which has only an algorythm. The most popular is any MD. Here are MD, MD-2, MD-3, MD-4, MD-5, MD-6. MD-5 is easy to hack now, becuase NO-KEY protection is old and weak. MD-6 uses 128bit hash size. Main concurent of MD-6 is old SHA-3.
Some SHA were NO-KEY too. SHA-1, SHA-2 were NO-KEY. SHA-3 had first attempts to make it ONE-KEY.
"ONE-KEY"
Rijndael
Advanced Encryption Standart
128 bit, one key 3 sizes: 192 bit, 128 bit, 256 bit. Key size depends on size of text to encode.
DES (one-love, I'll tell why later!)
Has 5 modifications: ECB, CBC, CFB, OFB, 3DEC.
ECB is most safety of these all. 3DEC is threefold repeated DEC. If you repeat ECB you'll have...
64*3=192bit hash, 56*3=168bit key. 16 (standart DES count of encoding cycles) * 3 = 48 cycles.
2^192 * 168 * 48 different codings.
DFC - Algorhythm with OPEN-CODE!
Assembly code:
void madd(u4byte acc[4], u4byte x[1], u4byte y[1])
{ __asm {
__asm mov ecx,x
__asm mov edx,y
__asm mov eax,[ecx]
__asm mov ecx,[edx]
__asm mul ecx
__asm mov ebx,acc
__asm xor ecx,ecx
__asm add [ebx],eax
__asm adc [ebx+4],edx
__asm adc [ebx+8],ecx
__asm adc [ebx+12],ecx
}
};
#endif
RC4 Algorythm WITH C# CODE:
using System;
using System.Linq;

namespace RC4_Testing
{
public class RC4
{
byte[] S = new byte[256];

int x = 0;
int y = 0;

public RC4(byte[] key)
{
init(key);
}

// Key-Scheduling Algorithm
// Алгоритм ключевого расписания
private void init(byte[] key)
{
int keyLength = key.Length;

for (int i = 0; i < 256; i++)
{
S[i] = (byte)i;
}

int j = 0;
for (int i = 0; i < 256; i++)
{
j = (j + S[i] + key[i % keyLength]) % 256;
S.Swap(i, j);
}
}

public byte[] Encode(byte[] dataB, int size)
{
byte[] data = dataB.Take(size).ToArray();

byte[] cipher = new byte[data.Length];

for (int m = 0; m < data.Length; m++)
{
cipher[m] = (byte)(data[m] ^ keyItem());
}

return cipher;
}
public byte[] Decode(byte[] dataB, int size)
{
return Encode(dataB, size);
}

// Pseudo-Random Generation Algorithm
// Генератор псевдослучайной последовательности
private byte keyItem()
{
x = (x + 1) % 256;
y = (y + S[x]) % 256;

S.Swap(x, y);

return S[(S[x] + S[y]) % 256];
}
}

static class SwapExt
{
public static void Swap<T>(this T[] array, int index1, int index2)
{
T temp = array[index1];
array[index1] = array[index2];
array[index2] = temp;
}
}
}
RC5 - new version of RC4
module counting
XOR added
***
And more than 30 algorhytms...
TWO-KEY
Has 2 keys. I won't decsribe them all. I'll post a math method to calc them.
1. Random numbers P, Q (1024 bit)
2. N=P*Q
3. Euler function(n) = (p-1)*(q-1)
4. Random number E
1 < E < Euler founction(n)
5. D*E should be
D*E=Euler function(n) * a + 1
E, N - Open key
D, N - private key.
JS code:
'use strict';

/**
* RSA hash function reference implementation.
* Uses BigInteger.js https://github.com/peterolson/BigInteger.js
* Code originally based on https://github.com/kubrickology/Bitcoin-explained/blob/master/RSA.js
*
* @namespace
*/
var RSA = {};

/**
* Generates a k-bit RSA public/private key pair
* https://en.wikipedia.org/wiki/RSA_(cryptosystem)#Code
*
* @param {keysize} int, bitlength of desired RSA modulus n (should be even)
* @returns {array} Result of RSA generation (object with three bigInt members: n, e, d)
*/
RSA.generate = function (keysize) {
/**
* Generates a random k-bit prime greater than √2 × 2^(k-1)
*
* @param {bits} int, bitlength of desired prime
* @returns {bigInt} a random generated prime
*/
function random_prime(bits) {
var min = bigInt(6074001000).shiftLeft(bits-33); // min ≈ √2 × 2^(bits - 1)
var max = bigInt.one.shiftLeft(bits).minus(1); // max = 2^(bits) - 1
while (true) {
var p = bigInt.randBetween(min, max); // WARNING: not a cryptographically secure RNG!
if (p.isProbablePrime(256)) return p;
}
}

// set up variables for key generation
var e = bigInt(65537), // use fixed public exponent
p, q, lambda;

// generate p and q such that λ(n) = lcm(p − 1, q − 1) is coprime with e and |p-q| >= 2^(keysize/2 - 100)
do {
p = random_prime(keysize / 2);
q = random_prime(keysize / 2);
lambda = bigInt.lcm(p.minus(1), q.minus(1));
} while (bigInt.gcd(e, lambda).notEquals(1) || p.minus(q).abs().shiftRight(keysize/2-100).isZero());

return {
n: p.multiply(q), // public key (part I)
e: e, // public key (part II)
d: e.modInv(lambda) // private key d = e^(-1) mod λ(n)
};
};

/**
* Encrypt
*
* @param {m} int / bigInt: the 'message' to be encoded
* @param {n} int / bigInt: n value returned from RSA.generate() aka public key (part I)
* @param {e} int / bigInt: e value returned from RSA.generate() aka public key (part II)
* @returns {bigInt} encrypted message
*/
RSA.encrypt = function(m, n, e){
return bigInt(m).modPow(e, n);
};

/**
* Decrypt
*
* @param {c} int / bigInt: the 'message' to be decoded (encoded with RSA.encrypt())
* @param {d} int / bigInt: d value returned from RSA.generate() aka private key
* @param {n} int / bigInt: n value returned from RSA.generate() aka public key (part I)
* @returns {bigInt} decrypted message
*/
RSA.decrypt = function(c, d, n){
return bigInt(c).modPow(d, n);
};
************************************
Why I said "DES One Love"
I have own DES modification.
Algorhytm:
1. Using DES 4 times
2. Calculating hex hash like this: 12ab
3. Calculating oct (8 bit): 12ab (hex) = 11253 (oct)
4. Numbers like 1,2,3,4,5, etc. are converting in oct
Letters like a,b,c...
ARE CONVERTING TO 26-bit (26 english letters)
THERE ARE NO ANY ENCODER THAT CONVERTS ALL TO 8BIT AND 26BIT.
And yes, soon I'll post open-source code.
P.S all decoders try to decode in 16bit. You can decode my hash only with special decoder which I'll post here soon too.
My encoder uses ONLY 4bit FOR KEY!!!
But there are 4 DES keys, 1 OCT key and 1 26bit key. 4*4+8+26=50bit at all. Modern SHA-512 has 512 bits, but easier to decode.


Blog Comments

No comments yet.

Sources

Source cited

Community Link

This blog relate to community

Bitcoin Miners
Community Reach
456
People
0
Coins
Blog Images

Click image to enlarge