Closed Morrismx closed 1 year ago
I cannot find the code you are showing with the screenshot. My DECUtil only has 633 lines of code and I cannot find GetTickCount64 at all in the whole project group either (search via Strg-Shift-F). Are you sure you are on a current version? Can you tell me on which version you are? Notice.txt and readme.md in the root directory should name the version as well as the documentation in the docs subfolder.
{*****
Delphi Encryption Compendium (DEC Part I)
Version 5.3 for Delphi 7 - 10.4 or higher/FPC 2.6 or higher
Remarks: Freeware, Copyright must be included
Original Author: (c) 2006 Hagen Reddmann, HaReddmann [at] T-Online [dot] de
Modifications: (c) 2008 Arvid Winkelsdorf, info [at] digivendo [dot] de
(c) 2017, 2021 decfpc
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****}
De: Markus @.> Responder a: MHumm/DelphiEncryptionCompendium @.> Fecha: miércoles, 23 de noviembre de 2022, 11:01 Para: MHumm/DelphiEncryptionCompendium @.> CC: Mauricio Herrera @.>, Author @.***> Asunto: Re: [MHumm/DelphiEncryptionCompendium] no compile on Linux (Issue #50)
I cannot find the code you are showing with the screenshot. My DECUtil only has 633 lines of code and I cannot find GetTickCount64 at all in the whole project group either (search via Strg-Shift-F). Are you sure you are on a current version? Can you tell me on which version you are? Notice.txt and readme.md in the root directory should name the version as well as the documentation in the docs subfolder.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
open DECUtil.pas an search for GetTickCount64
Why do you use V5.3? The last official release is 6.4.1 and there changed quite a lot. 5.3 is no longer maintained, while 6.4.1 should be cross platform compatible! I used it in an Android app once and there are two of the FMX based demos available in Google Play: "DEC CIpher Demo" and "DEC Hash Demo". I would like to close this because it should work in 6.4.1.
This is the correct link?
https://github.com/MHumm/DelphiEncryptionCompendium
?
De: Markus @.> Responder a: MHumm/DelphiEncryptionCompendium @.> Fecha: miércoles, 23 de noviembre de 2022, 11:12 Para: MHumm/DelphiEncryptionCompendium @.> CC: Mauricio Herrera @.>, Author @.***> Asunto: Re: [MHumm/DelphiEncryptionCompendium] no compile on Linux (Issue #50)
Why do you use V5.3? The last official release is 6.4.1 and there changed quite a lot. 5.3 is no longer maintained, while 6.4.1 should be cross platform compatible! I used it in an Android app once and there are two of the FMX based demos available in Google Play: "DEC CIpher Demo" and "DEC Hash Demo". I would like to close this because it should work in 6.4.1.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Yes. The releases are in the right hand side panel. Or the direct link to them is here: https://github.com/MHumm/DelphiEncryptionCompendium/releases
In contrast to DEC 5.3 the 6.4.1 release does contain quite a bit of documentation found in the docs subfolder. Please read it, as it will describe the changes made between the releases as well. I tried to keep the interface as close to the old one as possible.
If you don't mind I'll close this issue now.
I need help,
I was given
KEY = 5oquil2oo2vb63e8ionujny6
IV = 12345678
And I need to decrypt XDhuT8YknqI= which is on base64 using 3DES CBC
On the sample says that key needs to be in HEX, so I should convert key to hex, will be 356f7175696c326f6f32766236336538696f6e756a6e7936
But I get wrong result
On old library I was using and the result was correct, I do not understand what am I doing wrong.
with TCipher_3DES.Create do
try
Mode:=cmCBCx;
Init('5oquil2oo2vb63e8ionujny6','12345678');
Decoded := DecodeBinary ('XDhuT8YknqI=',TFormat_MIME64 ); //XDhuT8YknqI= //y/3R651R/AnKxkdtFkUZpihKnpKe9Orx
finally
Free;
end;
any help is appreciated
Thanks
De: Markus @.> Responder a: MHumm/DelphiEncryptionCompendium @.> Fecha: miércoles, 23 de noviembre de 2022, 11:30 Para: MHumm/DelphiEncryptionCompendium @.> CC: Mauricio Herrera @.>, Author @.***> Asunto: Re: [MHumm/DelphiEncryptionCompendium] no compile on Linux (Issue #50)
Yes. The releases are in the right hand side panel. Or the direct link to them is here: https://github.com/MHumm/DelphiEncryptionCompendium/releases
In contrast to DEC 5.3 the 6.4.1 release does contain quite a bit of documentation found in the docs subfolder. Please read it, as it will describe the changes made between the releases as well. I tried to keep the interface as close to the old one as possible.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
You have not yet specified the expected result. How shall anybody trying to help you know, whether his code is correct?
The result is plain text, the decrypted text is 070 or MDcy on base64
Please help, I’m not expert
De: Markus @.> Responder a: MHumm/DelphiEncryptionCompendium @.> Fecha: miércoles, 23 de noviembre de 2022, 12:47 Para: MHumm/DelphiEncryptionCompendium @.> CC: Mauricio Herrera @.>, Author @.***> Asunto: Re: [MHumm/DelphiEncryptionCompendium] no compile on Linux (Issue #50)
You have not yet specified the expected result. How shall anybody trying to help you know, whether his code is correct?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Please specify clearly the following things:
The key you specify has 24 chars/bytes. But DES is only a 56/64 bit encryption algorithm so the init method complains about the key being too long. The code which created the encrypted data, was this done with DEC as well?
Hi,
Version is 6.4.1 Encrypted text is XDhuT8YknqI= and is on Base64 The key I was given is 5oquil2oo2vb63e8ionujny6 They used 3DES CBC
The old version decrypted the text correctly, just no works on Linux.
On the demo program, it says that key needs to be on HEX, im not sure how is the correct way to convert 5oquil2oo2vb63e8ionujny6 to hex
If you use this link
https://www.devglan.com/online-tools/triple-des-encrypt-decrypt
and enter the params
Enter text to be Decrypted = XDhuT8YknqI=
Select Mode = CBC
Triple DES Decrypted Output (Base64): = MDcy
Plain Text = 072
This is what I need to achive.
Thank you
De: Markus @.> Responder a: MHumm/DelphiEncryptionCompendium @.> Fecha: miércoles, 23 de noviembre de 2022, 13:01 Para: MHumm/DelphiEncryptionCompendium @.> CC: Mauricio Herrera @.>, Author @.***> Asunto: Re: [MHumm/DelphiEncryptionCompendium] no compile on Linux (Issue #50)
Please specify clearly the following things: The code you show above, is this developed with DEC 5.3 or 6.4.1? Which text is your encrypted text? 'XDhuT8YknqI=' And this is Mime64 or Base64? When was the mime applied? Before calling the encryption method or after encryption? What exactly is the correct result? As string? Or as Hex? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Try this one, it has only one flaw left: the output string is too long, but it starts with your expected data. I won't do more on this tonight.
program DESTest;
{$APPTYPE CONSOLE}
{$R *.res}
uses System.SysUtils, DECCipherBase in '..\Source\DECCipherBase.pas', DECCipherModes in '..\Source\DECCipherModes.pas', DECCiphers in '..\Source\DECCiphers.pas', DECFormat in '..\Source\DECFormat.pas';
var DES: TCipher_3DES; DecodeStr : RawByteString; ByteArr : TBytes; begin DES := TCipher_3DES.Create;
try try DES.Mode := TCipherMode.cmCBCx; DES.Init(RawByteString('5oquil2oo2vb63e8ionujny6'), RawByteString('12345678'));
DecodeStr := TFormat_Base64.Decode(RawByteString('XDhuT8YknqI='));
SetLength(ByteArr, length(DecodeStr));
Move(DecodeStr[low(DecodeStr)], ByteArr[0], length(DecodeStr));
ByteArr := DES.DecodeBytes(ByteArr);
SetLength(DecodeStr, length(ByteArr));
Move(ByteArr[0], DecodeStr[low(DecodeStr)], length(DecodeStr));
WriteLn(DecodeStr);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
finally DES.Free; end;
ReadLn; end.
Thank you very much 🙏🏻 I can confirm that it worked perfectly fine on Linux Server, on a web application. Best Regards,Mauricio HerreraMex Dial 5520959678US Dial 01152-5520959678El 23 nov 2022, a la(s) 1:19 p.m., Markus @.**> escribió: Try this one, it has only one flaw left: the output string is too long, but it starts with your expected data. I won't do more on this tonight. program DESTest; {$APPTYPE CONSOLE} {$R .res} uses System.SysUtils, DECCipherBase in '..\Source\DECCipherBase.pas', DECCipherModes in '..\Source\DECCipherModes.pas', DECCiphers in '..\Source\DECCiphers.pas', DECFormat in '..\Source\DECFormat.pas'; var DES: TCipher_3DES; DecodeStr : RawByteString; ByteArr : TBytes; begin DES := TCipher_3DES.Create; try try DES.Mode := TCipherMode.cmCBCx; DES.Init(RawByteString('5oquil2oo2vb63e8ionujny6'), RawByteString('12345678')); DecodeStr := TFormat_Base64.Decode(RawByteString('XDhuT8YknqI=')); SetLength(ByteArr, length(DecodeStr)); Move(DecodeStr[low(DecodeStr)], ByteArr[0], length(DecodeStr));
ByteArr := DES.DecodeBytes(ByteArr);
SetLength(DecodeStr, length(ByteArr)); Move(ByteArr[0], DecodeStr[low(DecodeStr)], length(DecodeStr));
WriteLn(DecodeStr); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end;
finally DES.Free; end; ReadLn; end.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
Closed as a working solution was provided to the user.
Hi!,
Hope you can help, now I need to encrypt a string, and I have modified the last example you sent, but the output string is shorter.
Using this online tool https://www.devglan.com/online-tools/triple-des-encrypt-decrypt
Text to encrypt 8800004100001178
Mode = CBC
IV = 12345678
Secret key = 5oquil2oo2vb63e8ionujny6
I get = pFY4vMFdwLezHjN8FhHblLIV2Z6jDn/6
Using this function that I modified based on your example, the result string is shorter.
Delphi output = pFY4vMFdwLezHjN8FhHblA==
Online tool = pFY4vMFdwLezHjN8FhHblLIV2Z6jDn/6
If I try to decrypt Delphi output using the online tool, it gives an error:
function Encrypt(const TextToEncrypt: String): String;
var
DES: TCipher_3DES;
DecodeStr,EcodedStr : RawByteString;
ByteArr,ByteEncoded : TBytes;
begin
DES := TCipher_3DES.Create;
try
try
DES.Mode := TCipherMode.cmCBCx;
DES.Init(RawByteString('5oquil2oo2vb63e8ionujny6'), RawByteString('12345678'));
DecodeStr :=RawByteString(TextToEncrypt);
SetLength(ByteArr, length(DecodeStr));
Move(DecodeStr[low(DecodeStr)], ByteArr[0], length(DecodeStr));
ByteEncoded := DES.EncodeBytes(ByteArr);
SetLength(EcodedStr, length(ByteEncoded));
Move(ByteEncoded[0], EcodedStr[low(EcodedStr)], length(ByteEncoded));
Result:=TFormat_Base64.Encode(EcodedStr );
except
on E: Exception do
ShowMessage(E.Message);
end;
finally
DES.Free;
end;
end;
Hope you can help.
ThankS
De: Mauricio Herrera @.> Fecha: miércoles, 23 de noviembre de 2022, 22:09 Para: MHumm/DelphiEncryptionCompendium @.> CC: MHumm/DelphiEncryptionCompendium @.>, Author @.> Asunto: Re: [MHumm/DelphiEncryptionCompendium] no compile on Linux (Issue #50)
Thank you very much 🙏🏻
I can confirm that it worked perfectly fine on Linux Server, on a web application.
Best Regards,
Mauricio Herrera
Mex Dial 5520959678
US Dial 01152-5520959678
El 23 nov 2022, a la(s) 1:19 p.m., Markus @.***> escribió:
Try this one, it has only one flaw left: the output string is too long, but it starts with your expected data. I won't do more on this tonight.
program DESTest;
{$APPTYPE CONSOLE}
{$R *.res}
uses System.SysUtils, DECCipherBase in '..\Source\DECCipherBase.pas', DECCipherModes in '..\Source\DECCipherModes.pas', DECCiphers in '..\Source\DECCiphers.pas', DECFormat in '..\Source\DECFormat.pas';
var DES: TCipher_3DES; DecodeStr : RawByteString; ByteArr : TBytes; begin DES := TCipher_3DES.Create;
try try DES.Mode := TCipherMode.cmCBCx; DES.Init(RawByteString('5oquil2oo2vb63e8ionujny6'), RawByteString('12345678')); DecodeStr := TFormat_Base64.Decode(RawByteString('XDhuT8YknqI=')); SetLength(ByteArr, length(DecodeStr)); Move(DecodeStr[low(DecodeStr)], ByteArr[0], length(DecodeStr));
ByteArr := DES.DecodeBytes(ByteArr);
SetLength(DecodeStr, length(ByteArr)); Move(ByteArr[0], DecodeStr[low(DecodeStr)], length(DecodeStr));
WriteLn(DecodeStr); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; finally DES.Free; end;
ReadLn; end.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Hello,
I tried to compile 3de on linux, and got
C:\.....\DelphiEncryptionCompendium\DECUtil.pas(627,24): error E2003: E2003 Undeclared identifier: 'GetTickCount64'
FMX on windows works fine with TCipher_3DES.Create do try Mode:=cmCBCx; Init('5oquil2oo2vb63e8ionujny6','12345678'); Decoded := DecodeBinary ('y/3R651R/AnKxkdtFkUZpihKnpKe9Orx',TFormat_MIME64 ); Free; end;