DarkCryptTC - Total Commander now is the best encryptor!!!

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Post by *alexanderwdark »

All functions is ready to use, and implementation of new ciphers is task simple for interest. Who knows, what it is better: IDEA NXT, Enrupt, Camellia or AES? Twofish or so popular Rijndael? Free noncommercial software - result of some free time and some ideas, which were simply interesting for me.
User avatar
sas2000
Power Member
Power Member
Posts: 682
Joined: 2003-02-07, 04:32 UTC
Location: Galiza

Post by *sas2000 »

 
Good work, but several new versions every week it's maybe too much :wink: .
 
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Post by *alexanderwdark »

sas2000 wrote: 
Good work, but several new versions every week it's maybe too much :wink: .
 
I say, it's nice to say that it's not new versions - it's my new plugin builds (i.e. not bugfixes), it's simply new ciphers or new ideas implementations...
dhanu
New Member
New Member
Posts: 1
Joined: 2008-11-03, 04:30 UTC

XXTEA implementation how to use from wikipedia

Post by *dhanu »

Hi

I am trying to implement in C code XXTEA.

please help me with the code


#include <stdlib.h>
#include <string.h>
#include <stdio.h>




/* #define MX (z>>5^y<<2) + (y>>3^z<<4)^(sum^y) + (key[p&3^e]^z) */
#define MX ( (((z>>5)^(y<<2))+((y>>3)^(z<<4)))^((sum^y)+(key[(p&3)^e]^z)) )



long btea(long* v, long length, long* key);

void main()
{
long length;
unsigned char buffer[30];
unsigned char key[30];
strcpy(buffer,"9248979020");
strcpy(key,"7813498");

length = strlen((long *)buffer);

printf("original buffer %s %ld\n",buffer,length);

btea((long *)buffer,length,(long *)key);
length = strlen((long *)buffer);
printf("encrypted buffer %s %ld\n",(char *)buffer,length);


length = - length;
btea((long *)buffer,length,(long *)key);
length = strlen((long *)buffer);
printf("decrypted buffer %s %ld \n",(char *)buffer,length);
getchar();
getchar();
}



long btea(long* v, long length, long* key) {
unsigned long z /* = v[length-1] */, y=v[0], sum=0, e, DELTA=0x9e3779b9;
long p, q ;
if (length > 1) { /* Coding Part */
z=v[length-1]; /* Moved z=v[length-1] to here, else segmentation fault in decode when length < 0 */
q = 6 + 52/length;
while (q-- > 0) {
sum += DELTA;
e = (sum >> 2) & 3;
for (p=0; p<length-1; p++) y = v[p+1], z = v[p] += MX;
y = v[0];
z = v[length-1] += MX;
}
return 0 ;
} else if (length < -1) { /* Decoding Part */
length = -length;
q = 6 + 52/length;
sum = q*DELTA ;
while (sum != 0) {
e = (sum >> 2) & 3;
for (p=length-1; p>0; p--) z = v[p-1], y = v[p] -= MX;
z = v[length-1];
y = v[0] -= MX;
sum -= DELTA;
}
return 0;
}
return 1;
}
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Re: XXTEA implementation how to use from wikipedia

Post by *alexanderwdark »

Use XTEA or RTEA code - they simple and has same security as xxtea.
See lot of ciphers source codes on my page here

This is one of XXTEA implementations, functions encrypts/derypts 30 unsigned long values block (optimal for XXTEA, more for xxtea_crypt is not so secure).


Code: Select all


/**********************************************************

           XXTEA 30 u32's - Tiny Encryption Algorithm
      
         Unrolled, tweaked by A.Myasnikov, DarkSoftware

************************************************************/





#include <string.h>;


#define u32 unsigned long


u32 key[4];



#define MX  ( (((z>>9)^(y<<2))+((y>>3)^(z<<6)))^((sum^y)+(key[(p&3)^e]^z)) )
 
  void xxtea_crypt (u32* v) {
    unsigned long z, y=v[0], sum=0, e, DELTA=0x9e3779b9;
    long p, q=12;
      z=v[29];       
      while (q-- > 0) {
        sum += DELTA;
        e = (sum >> 2) & 3;
        for (p=0; p<29; p++) y = v[p+1], z = v[p] += MX;
        y = v[0];
        z = v[29] += MX;
      }

  }


  void xxtea_decrypt (u32* v) {
    unsigned long z, y=v[0], sum=0, e, DELTA=0x9e3779b9;
    long p, q=12;
      sum = q*DELTA ;
      while (sum != 0) {
        e = (sum >> 2) & 3;
        for (p=29; p>0; p--) z = v[p-1], y = v[p] -= MX;
        z = v[29];
        y = v[0] -= MX;
        sum -= DELTA;
      }

    }


void __export __stdcall setup (u32 *data)
{
    
memmove(&key[0],&data[0],16);

}



void __export __stdcall crypt (u32 *data)
{
    
 xxtea_crypt(data);
 
}

void __export __stdcall decrypt (u32 *data)
{
    
xxtea_decrypt(data);

}


How to use it. You must implement also some hash function (i.e. Ripe-MD 128, XorBuff function and function to generate IV)

Code: Select all


procedure xxteatw30comp (si, st, key: string);
var
  FileIn, FileOut: TFileStream;
  Buffer, Dest: array [0..119] of byte;
  iv:  array [0..119] of byte;
  iv2: array [0..15] of byte;
  iv3: array [0..7] of byte;
  xbuf: array [0..119] of byte;
  BlockSize: longword;
  Left, I, N: longint;
  FName: string;
  digest: array[0..15] of byte;

var
  setup: procedure (key: pointer); stdcall;

var
  crypt: procedure (froms: pointer); stdcall;

var
  hdll: THandle;

begin

  hdll := LoadLibrary(PChar(dll + 'libxxtea30.dll'));
  if hdll <> 0 then
    begin
    setup := Windows.GetProcAddress(hdll, 'setup');
    crypt := Windows.GetProcAddress(hdll, 'crypt');
    if (@crypt = nil) or (@setup = nil) then
      begin
      ShowMessage('Functions not found!');
      end;
    end
  else
    ShowMessage('XXTEA-tw30 not loaded!');



// Here use get hash digest of key string


  FillChar(iv3, 8, $FF);
  FillChar(iv, 120, $FF);

// Here compute iv block



  prg  := 0;
  FileIn := TFileStream.Create(si, fmOpenRead or fmShareDenyWrite);
  FileOut := TFileStream.Create(st, fmCreate);
  Left := FileIn.Size;
  FillChar(Buffer, 120, 0);
  FillChar(Dest, 120, 0);

  setup(@digest);


  repeat
    if left < 120 then
      begin
      for n := 0 to 119 do
        buffer[n] := random(256) xor rndtick;
      end;

    blocksize := 120;
    FileIn.Read(Buffer, blocksize);
    XorBuff(@Buffer, @Iv, 120, @XBuf); // Here write CBC routine
    Crypt(@XBuf);
    Move(XBuf, Iv, 120);
    FileOut.Write(XBuf, blocksize);
    ShowPDP(PChar(si), blocksize); // Some progress bar
    Dec(left, blocksize);
  until left <= 0;


  FileIn.Destroy;
  FileOut.Destroy;

  if hdll <> 0 then
    FreeLibrary(hdll);

end;


procedure xxteatw30dcomp (si, st, key: string);
var
  FileIn, FileOut: TFileStream;
  Buffer, Dest: array [0..119] of byte;
  iv:  array [0..119] of byte;
  iv2: array [0..15] of byte;
  iv3: array [0..7] of byte;
  xbuf: array [0..119] of byte;
  BlockSize: longword;
  Left, I, N: longint;
  FName: string;
  digest: array[0..15] of byte;

var
  setup: procedure (key: pointer); stdcall;

var
  crypt: procedure (froms: pointer); stdcall;

var
  hdll: THandle;

begin

  hdll := LoadLibrary(PChar(dll + 'libxxtea30.dll'));
  if hdll <> 0 then
    begin
    setup := Windows.GetProcAddress(hdll, 'setup');
    crypt := Windows.GetProcAddress(hdll, 'decrypt');
    if (@crypt = nil) or (@setup = nil) then
      begin
      ShowMessage('Functions not found!');
      end;
    end
  else
    ShowMessage('XXTEA-tw30 not loaded!');


// key ---> digest



  FillChar(iv3, 8, $FF);
  FillChar(iv, 120, $FF);


// ---> iv



  prg  := 0;
  FileIn := TFileStream.Create(si, fmOpenRead or fmShareDenyWrite);
  FileOut := TFileStream.Create(st, fmCreate);
  Left := FileIn.Size;
  FillChar(Buffer, 120, 0);
  FillChar(Dest, 120, 0);

  setup(@digest);

  repeat
    blocksize := 120;
    FileIn.Read(Buffer, blocksize);
    Move(buffer, Dest, 120);
    Crypt(@Buffer);
    XorBuff(@Buffer, @Iv, 120, @XBuf);
    Move(Dest, Iv, 120);
    FileOut.Write(XBuf, blocksize);
    ShowPDP(PChar(si), blocksize); // process
    Dec(left, blocksize);
  until left <= 0;


  FileIn.Destroy;
  FileOut.Seek(arcrec.size, 0);
  FileOut.Size := arcrec.size;  // Because of size is x*120 bytes long setting correct length
  FileOut.Destroy;

  if hdll <> 0 then
    FreeLibrary(hdll);

end;
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Re: XXTEA implementation how to use from wikipedia

Post by *alexanderwdark »

29.11.2008: Strong optimization, speedup of many cipher engines,
User avatar
CG!
Junior Member
Junior Member
Posts: 21
Joined: 2008-11-10, 03:44 UTC

Post by *CG! »

The link for the simple GUi delivers error 404 to me?
Any other place, where i can download it?
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
User avatar
CG!
Junior Member
Junior Member
Posts: 21
Joined: 2008-11-10, 03:44 UTC

Post by *CG! »

Thanks alot.
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Post by *alexanderwdark »

Thanx, link to GUI fixed!

Link for the latest version of DarkCrypt GUI (29.11.2008)

Please, use this, latest version, it contains optimized version of darkcrypttc and all the latest cipher implementations.
User avatar
CG!
Junior Member
Junior Member
Posts: 21
Joined: 2008-11-10, 03:44 UTC

Post by *CG! »

Thanks again.
The new link works ... even for me. ^^

Thought copying the new plugin into the somelibs folder would be enough, but the new GUi executable is 2b bigger.
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Post by *alexanderwdark »

CG! wrote:Thanks again.
The new link works ... even for me. ^^

Thought copying the new plugin into the somelibs folder would be enough, but the new GUi executable is 2b bigger.
Yeah,it would be enough, GUI is unchanged, just recompiled and repacked by PE-packer in build script.

P.S. There is new build of darkcrypt plugin with optimized stream reading engine for some ciphers, it was uploaded today on 11.20 GMT :)

DarkCryptTC II

DarkCrypt GUI
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Post by *alexanderwdark »

04.12.2008 DarkCrypt III, most secure key and IV generation and transforming (special Skein hash function rounds), version can't handle DarkCrypt II files, please decrypt before update (!)


DarkCryptTC II

DarkCrypt GUI
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Post by *alexanderwdark »

06.12.2008 1:15 GMT Re-uploaded fixed DarkCrypt III (some other ciphers now has special strong iv-generator and keysetup, please, decipher all files)


DarkCryptTC II

DarkCrypt GUI
User avatar
alexanderwdark
Senior Member
Senior Member
Posts: 270
Joined: 2008-04-14, 07:20 UTC
Location: Russia
Contact:

Post by *alexanderwdark »

06.12.2008 19:00 GMT New! Use integrated Crypto-safe password generator (right-click on the cd button in main window)

DarkCryptTC II

DarkCrypt GUI
Post Reply