Welcome Guest [Log In] [Register]
Welcome to Crypto. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Substitution Cipher Cracker
Topic Started: Dec 15 2006, 03:32 PM (375 Views)
Revelation
Member Avatar
Administrator
[ *  *  *  *  * ]
To crack my substitution ciphers faster without brute-forcing them, I have made an application that simplifies the char substitution and frequency counting.

How to use:

Paste a text in the Memo-field below Cipher text. Then press analyze. Now you get a list of all the chars that are in the text (if you haven't enabled any filters) along with their frequencies. They are displayed in a grid. The chars are in the first column, the frequencies in the third. In the second column you can enter your new chars. The plain text gets auto-updated after a change. You don't have to back things up, for if you erase your own char, the application will use the cipher char again.

Download here (Win32 executable packed in a rar).
RRRREJMEEEEEPVKLWENFNVJKEEEEEAOLKAFKLXCFZAASDJXZTTTTTTTLSIOWJXMOKLAFJNNKFNXN
RAGRBAQEMHIGDJVDSEOXVIYCELFHWLELJFIENXLRATALSJFSLCYTKLASJDKMHGOVOKAJDNMNUITN
RRRRLJVEEEEECLYVYHNVPFTAEEEEEMWLMEIRNGLARWJAKJDFLWNTIERJMIPQWOTZEOCXKNUBNXCN
RJIRPOWEANFUSNCZVDVZNMSFEKLOEPZLDKDJWSAAAAAAAOERHJCTNCKFRIMVKSOFOMKMANREWNBN
RZUDRGXEEEEENFQIDVLQNCKNEEEEEDGLLLLLLAWIOSNCDARLODMTOEJXMILDFJROTKJSDNLVCZNN
Offline Profile Quote Post Goto Top
 
jdege
Member Avatar
Elite member
[ *  *  *  *  * ]
Revelation
Dec 15 2006, 03:32 PM
Download here (Win32 executable packed in a rar).

Win32 EXEs aren't of much use to me.

I can't run them at home, I won't run them at work, and since I can't read the source I can't learn anything from them.

When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
Offline Profile Quote Post Goto Top
 
Donald
Elite member
[ *  *  *  *  * ]
was it written in Delphi?
Offline Profile Quote Post Goto Top
 
Revelation
Member Avatar
Administrator
[ *  *  *  *  * ]
Yes, it is written in Delphi. The source is pretty simple:

Quote:
 
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, ValEdit, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    SG: TStringGrid;
    Memo1: TMemo;
    CheckBox1: TCheckBox;
    Memo2: TMemo;
    Label1: TLabel;
    Label2: TLabel;
    CheckBox2: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure SGSelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure SGSetEditText(Sender: TObject; ACol, ARow: Integer;
      const Value: string);
    procedure UpdateText;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  CharsInCT, ReplacementChar, PlaceInSG: array[0..255] of integer;
  onlyalpha, onlyprintable, incpunct: boolean;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  i, rowpointer: integer;
begin
  onlyalpha := CheckBox1.Checked;
  onlyprintable := CheckBox2.Checked;

  SG.RowCount := 0; // reset the field

  for i := 0 to 255 do
  begin
    CharsInCT := 0;
    ReplacementChar := -1;
  end;

  for i := 1 to Length(Memo1.Text) do
  begin
    CharsInCT[Ord(Memo1.Text)] := CharsInCT[Ord(Memo1.Text)] + 1;
  end;

  rowpointer := 0;
  for i := 0 to 255 do
  begin
    if onlyalpha then
      if not (i in [65..90]) then
      Continue;

    if onlyprintable then
    begin
      if i <= 32 then // also exclude space
      Continue;
    end;

    if CharsInCT > 0 then
    begin
      if rowpointer + 1 > SG.RowCount then
        SG.RowCount := SG.RowCount + 1;

      PlaceInSG := rowpointer;
      Sg.Cells[0, rowpointer] := Chr(i);
      Sg.Cells[2, rowpointer] := IntToStr(CharsInCT);

      Inc(rowpointer); 
    end;
  end;

  Memo2.Text := Memo1.Text;

end;

procedure TForm1.UpdateText;
var
  i: integer;
  astring: string;
begin
  Memo2.Clear;
  astring := '';
  SetLength(astring, Length(Memo1.Text));
// FillChar(astring, 4999, #0);

  for i := 1 to Length(Memo1.Text) do
  begin
    if onlyalpha then
    if not (Ord(Memo1.Text) in [65..90]) then
    begin
      astring := Memo1.Text;
      Continue;
    end;

    if onlyprintable then
    if Ord(Memo1.Text) <= 33 then
    begin
      astring := Memo1.Text;
      Continue;
    end;

      if Sg.Cells[1, PlaceInSG[Ord(Memo1.Text)]] = '' then
        astring := Sg.Cells[0, PlaceInSG[Ord(Memo1.Text)]][1]
      else
        astring := Sg.Cells[1, PlaceInSG[Ord(Memo1.Text)]][1];
  end;

  Memo2.Text := astring;
end;

procedure TForm1.SGSelectCell(Sender: TObject; ACol, ARow: Integer;
  var CanSelect: Boolean);
begin
  if (ACol = 0) or (ACol = 2) then
    CanSelect := False;
end;

procedure TForm1.SGSetEditText(Sender: TObject; ACol, ARow: Integer;
  const Value: string);
begin
  if Length(Value) > 1 then
    SG.Cells[ACol, ARow] := Copy(Value, 1, 1);

  UpdateText;
end;

end.


RRRREJMEEEEEPVKLWENFNVJKEEEEEAOLKAFKLXCFZAASDJXZTTTTTTTLSIOWJXMOKLAFJNNKFNXN
RAGRBAQEMHIGDJVDSEOXVIYCELFHWLELJFIENXLRATALSJFSLCYTKLASJDKMHGOVOKAJDNMNUITN
RRRRLJVEEEEECLYVYHNVPFTAEEEEEMWLMEIRNGLARWJAKJDFLWNTIERJMIPQWOTZEOCXKNUBNXCN
RJIRPOWEANFUSNCZVDVZNMSFEKLOEPZLDKDJWSAAAAAAAOERHJCTNCKFRIMVKSOFOMKMANREWNBN
RZUDRGXEEEEENFQIDVLQNCKNEEEEEDGLLLLLLAWIOSNCDARLODMTOEJXMILDFJROTKJSDNLVCZNN
Offline Profile Quote Post Goto Top
 
Donald
Elite member
[ *  *  *  *  * ]
cool, thanks!
Offline Profile Quote Post Goto Top
 
insecure
Elite member
[ *  *  *  *  * ]
You'd have to be pretty dumb to download a Windows executable program from a Web site. (Yes, I have at least a couple of Windows executable programs available for download from my own site!)

And you'd have to be very dumb indeed to download a Windows executable program from a Web site whose raison d'etre is at least in part that of exploring computer security vulnerabilities!

Nothing against Revelation, I hasten to add, but let us never forget that "I trust X" is merely another way of saying "I am vulnerable to X".

It is probably advisable to encourage best security practice by posting source code, rather than executables. Ideally in a cross-platform language, too. (C, C++, Pascal, Java, Perl, Python, PHP...) I know Delphi is a Pascal variant, but it's sufficiently variant that the source is of no direct use to me - I'd have to translate it. Mind you, it does seem to have much the same purpose as my own msc cracker, which I posted here a few aeons ago, so I don't suppose I'm missing too much on this occasion!
Offline Profile Quote Post Goto Top
 
jdege
Member Avatar
Elite member
[ *  *  *  *  * ]
insecure
Jan 12 2007, 02:08 AM
It is probably advisable to encourage best security practice by posting source code, rather than executables. Ideally in a cross-platform language, too. (C, C++, Pascal, Java, Perl, Python, PHP...) I know Delphi is a Pascal variant, but it's sufficiently variant that the source is of no direct use to me - I'd have to translate it.

I'm more interested in learning ideas than I am in grabbing snippets of code I can use without understanding the ideas.

So Delphi is fine.
When cryptography is outlawed, bayl bhgynjf jvyy unir cevinpl.
Offline Profile Quote Post Goto Top
 
insecure
Elite member
[ *  *  *  *  * ]
An excellent attitude.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · General · Next Topic »
Add Reply