<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Encryption, cypher and hashes(1)</title>
	<atom:link href="http://www.alldelphi.com/2008/06/24/encryption-ciphers-and-hashes1/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alldelphi.com/2008/06/24/encryption-ciphers-and-hashes1/</link>
	<description>Everything You Want To Know From VCL, Tips To Snippet All Everything About Delphi And CodeGear Related</description>
	<lastBuildDate>Thu, 10 Dec 2009 10:52:42 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Phil Read</title>
		<link>http://www.alldelphi.com/2008/06/24/encryption-ciphers-and-hashes1/comment-page-1/#comment-19395</link>
		<dc:creator>Phil Read</dc:creator>
		<pubDate>Thu, 10 Dec 2009 10:52:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.alldelphi.com/?p=25#comment-19395</guid>
		<description>Finally got it working in C++ Builder 2009 using this:

TDCP_rijndael *Cipher = new TDCP_rijndael (this);

  String KeyStr = KeyEdit-&gt;Text;

  String encrypted = EncryptedEdit-&gt;Text;
  String decrypted = &quot;&quot;;

  Cipher-&gt;InitStr (KeyStr, __classid (TDCP_sha1));

  decrypted = Cipher-&gt;DecryptString(encrypted);
  DecryptedEdit-&gt;Text = decrypted;

  Cipher-&gt;Burn();
  Cipher-&gt;Free();

Now of course my decrpyt doesn&#039;t work... Basically I have encrypted a string using mySQL&#039;s AES_ENCRYPT() and am now trying to decrpyt back to plain text using the above code. I have the correct key etc, anyone have any idea? Should I be passing the encrypted message in a non-text format, like binary or something?

Thanks muchly!</description>
		<content:encoded><![CDATA[<p>Finally got it working in C++ Builder 2009 using this:</p>
<p>TDCP_rijndael *Cipher = new TDCP_rijndael (this);</p>
<p>  String KeyStr = KeyEdit-&gt;Text;</p>
<p>  String encrypted = EncryptedEdit-&gt;Text;<br />
  String decrypted = &#8220;&#8221;;</p>
<p>  Cipher-&gt;InitStr (KeyStr, __classid (TDCP_sha1));</p>
<p>  decrypted = Cipher-&gt;DecryptString(encrypted);<br />
  DecryptedEdit-&gt;Text = decrypted;</p>
<p>  Cipher-&gt;Burn();<br />
  Cipher-&gt;Free();</p>
<p>Now of course my decrpyt doesn&#8217;t work&#8230; Basically I have encrypted a string using mySQL&#8217;s AES_ENCRYPT() and am now trying to decrpyt back to plain text using the above code. I have the correct key etc, anyone have any idea? Should I be passing the encrypted message in a non-text format, like binary or something?</p>
<p>Thanks muchly!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Read</title>
		<link>http://www.alldelphi.com/2008/06/24/encryption-ciphers-and-hashes1/comment-page-1/#comment-19394</link>
		<dc:creator>Phil Read</dc:creator>
		<pubDate>Thu, 10 Dec 2009 10:04:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.alldelphi.com/?p=25#comment-19394</guid>
		<description>Thanks for your help... Yes I have already reproduced all that in C++ Builder, the problem is the line:

Cipher.InitStr(KeyStr,TDCP_sha1);

Which in C++ Builder would be:

Cipher-&gt;InitStr(KeyStr,TDCP_sha1);

But it kicks up a fuss about: Improper use of typedef ‘TDCP_sha1′ other people seem to of had this problem, but I tried their solution and it still had problems: http://www.c-plusplus.de/forum/viewtopic-var-t-is-119771.html

Cheers ;)</description>
		<content:encoded><![CDATA[<p>Thanks for your help&#8230; Yes I have already reproduced all that in C++ Builder, the problem is the line:</p>
<p>Cipher.InitStr(KeyStr,TDCP_sha1);</p>
<p>Which in C++ Builder would be:</p>
<p>Cipher-&gt;InitStr(KeyStr,TDCP_sha1);</p>
<p>But it kicks up a fuss about: Improper use of typedef ‘TDCP_sha1′ other people seem to of had this problem, but I tried their solution and it still had problems: <a href="http://www.c-plusplus.de/forum/viewtopic-var-t-is-119771.html" rel="nofollow">http://www.c-plusplus.de/forum/viewtopic-var-t-is-119771.html</a></p>
<p>Cheers <img src='http://www.alldelphi.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.alldelphi.com/2008/06/24/encryption-ciphers-and-hashes1/comment-page-1/#comment-19393</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 10 Dec 2009 09:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.alldelphi.com/?p=25#comment-19393</guid>
		<description>this is how i do it in delphi

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,   -&gt;  DCPcrypt2, DCPrc4,  DCPsha1  &lt;-- I Add This then all work;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  i: integer;
  Cipher: TDCP_rc4;
  KeyStr: string;
begin
  KeyStr:= &#039;&#039;;
  if InputQuery(&#039;Passphrase&#039;,&#039;Enter passphrase&#039;,KeyStr) then // get the passphrase
  begin
    Cipher:= TDCP_rc4.Create(Self);
    Cipher.InitStr(KeyStr,TDCP_sha1); // initialize the cipher with a hash of the passphrase
    for i:= 0 to Memo1.Lines.Count-1 do // decrypt the contents of the memo
      Memo1.Lines[i]:= Cipher.DecryptString(Memo1.Lines[i]);
    Cipher.Burn;
    Cipher.Free;
  end;
end;</description>
		<content:encoded><![CDATA[<p>this is how i do it in delphi</p>
<p>unit Unit1;</p>
<p>interface</p>
<p>uses<br />
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br />
  Dialogs, StdCtrls,   ->  DCPcrypt2, DCPrc4,  DCPsha1  <&#8211; I Add This then all work;</p>
<p>type<br />
  TForm1 = class(TForm)<br />
    Button1: TButton;<br />
    Memo1: TMemo;<br />
    procedure Button1Click(Sender: TObject);<br />
  private<br />
    { Private declarations }<br />
  public<br />
    { Public declarations }<br />
  end;</p>
<p>var<br />
  Form1: TForm1;</p>
<p>implementation</p>
<p>{$R *.dfm}</p>
<p>procedure TForm1.Button1Click(Sender: TObject);<br />
var<br />
  i: integer;<br />
  Cipher: TDCP_rc4;<br />
  KeyStr: string;<br />
begin<br />
  KeyStr:= &#8221;;<br />
  if InputQuery(&#8217;Passphrase&#8217;,'Enter passphrase&#8217;,KeyStr) then // get the passphrase<br />
  begin<br />
    Cipher:= TDCP_rc4.Create(Self);<br />
    Cipher.InitStr(KeyStr,TDCP_sha1); // initialize the cipher with a hash of the passphrase<br />
    for i:= 0 to Memo1.Lines.Count-1 do // decrypt the contents of the memo<br />
      Memo1.Lines[i]:= Cipher.DecryptString(Memo1.Lines[i]);<br />
    Cipher.Burn;<br />
    Cipher.Free;<br />
  end;<br />
end;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Read</title>
		<link>http://www.alldelphi.com/2008/06/24/encryption-ciphers-and-hashes1/comment-page-1/#comment-19392</link>
		<dc:creator>Phil Read</dc:creator>
		<pubDate>Thu, 10 Dec 2009 08:23:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.alldelphi.com/?p=25#comment-19392</guid>
		<description>Hi,

Here&#039;s the code snippet, I have the unit :

#include &quot;dcpsha1.hpp&quot;

.
.
.

int i;
TDCP_rc4 *Cipher;
String KeyStr;

Cipher-&gt;InitStr(KeyStr,TDCP_sha1); // this causes ERROR: Improper use of typedef &#039;TDCP_sha1&#039;</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Here&#8217;s the code snippet, I have the unit :</p>
<p>#include &#8220;dcpsha1.hpp&#8221;</p>
<p>.<br />
.<br />
.</p>
<p>int i;<br />
TDCP_rc4 *Cipher;<br />
String KeyStr;</p>
<p>Cipher-&gt;InitStr(KeyStr,TDCP_sha1); // this causes ERROR: Improper use of typedef &#8216;TDCP_sha1&#8242;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.alldelphi.com/2008/06/24/encryption-ciphers-and-hashes1/comment-page-1/#comment-19391</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 10 Dec 2009 01:44:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.alldelphi.com/?p=25#comment-19391</guid>
		<description>hi Phil, 

 did the unit library is already included properly at the uses ?
as when you do the &quot;chiper.initstr(KeyStr,TDCP_sha1)&quot;, you use TDCP_Sha1 component and for that you 
need to include the DCPsha1 unit on the library .</description>
		<content:encoded><![CDATA[<p>hi Phil, </p>
<p> did the unit library is already included properly at the uses ?<br />
as when you do the &#8220;chiper.initstr(KeyStr,TDCP_sha1)&#8221;, you use TDCP_Sha1 component and for that you<br />
need to include the DCPsha1 unit on the library .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Read</title>
		<link>http://www.alldelphi.com/2008/06/24/encryption-ciphers-and-hashes1/comment-page-1/#comment-19390</link>
		<dc:creator>Phil Read</dc:creator>
		<pubDate>Thu, 10 Dec 2009 01:38:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.alldelphi.com/?p=25#comment-19390</guid>
		<description>Hi, I&#039;ve installed the &#039;DCPcrypt Cryptographic Component Library&#039; in Builder C++ 2009, the components look fine.

But I&#039;m haivng trouble converting the really simple delphi example to C++ just on one line:

Cipher.InitStr(KeyStr,TDCP_sha1);    

It says Cipher.InitStr expects a TMetaClass* where &#039;TDCP_sha1&#039; us shown in the above line, I&#039;vew tried everything and I can&#039;t work out what to pass in there for c++ any ideas?

Cheers! ;)

P.S - Simple delphi example below: 

 procedure TForm1.btnDecryptClick(Sender: TObject);
  var
	i: integer;
    Cipher: TDCP_rc4;
    KeyStr: string;
  begin
	KeyStr:= &#039;&#039;;
	if InputQuery(&#039;Passphrase&#039;,&#039;Enter passphrase&#039;,KeyStr) then  // get the passphrase
	begin
	  Cipher:= TDCP_rc4.Create(Self);
	  Cipher.InitStr(KeyStr,TDCP_sha1);         // initialize the cipher with a hash of the passphrase
	  for i:= 0 to Memo1.Lines.Count-1 do       // decrypt the contents of the memo
		Memo1.Lines[i]:= Cipher.DecryptString(Memo1.Lines[i]);
	  Cipher.Burn;
	  Cipher.Free;
    end;
  end;</description>
		<content:encoded><![CDATA[<p>Hi, I&#8217;ve installed the &#8216;DCPcrypt Cryptographic Component Library&#8217; in Builder C++ 2009, the components look fine.</p>
<p>But I&#8217;m haivng trouble converting the really simple delphi example to C++ just on one line:</p>
<p>Cipher.InitStr(KeyStr,TDCP_sha1);    </p>
<p>It says Cipher.InitStr expects a TMetaClass* where &#8216;TDCP_sha1&#8242; us shown in the above line, I&#8217;vew tried everything and I can&#8217;t work out what to pass in there for c++ any ideas?</p>
<p>Cheers! <img src='http://www.alldelphi.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>P.S &#8211; Simple delphi example below: </p>
<p> procedure TForm1.btnDecryptClick(Sender: TObject);<br />
  var<br />
	i: integer;<br />
    Cipher: TDCP_rc4;<br />
    KeyStr: string;<br />
  begin<br />
	KeyStr:= &#8221;;<br />
	if InputQuery(&#8217;Passphrase&#8217;,'Enter passphrase&#8217;,KeyStr) then  // get the passphrase<br />
	begin<br />
	  Cipher:= TDCP_rc4.Create(Self);<br />
	  Cipher.InitStr(KeyStr,TDCP_sha1);         // initialize the cipher with a hash of the passphrase<br />
	  for i:= 0 to Memo1.Lines.Count-1 do       // decrypt the contents of the memo<br />
		Memo1.Lines[i]:= Cipher.DecryptString(Memo1.Lines[i]);<br />
	  Cipher.Burn;<br />
	  Cipher.Free;<br />
    end;<br />
  end;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
