samrocketman/ekeyfinder

Algorithm to decode Adobe keys

Opened this issue · 1 comments

Perhaps document in the README the Adobe algorithm.

ekeyfinder/Main.pas

Lines 2893 to 2932 in d8e5904

function TfrmMain.DecodeAdobeKey(const sAdobeEncryptedKey: string): string;
// Decode Adobe Key Encryption. A simple substitution cipher.
// Converted from Dave Hope's original C++ version
// Copyright (C) 2008 VersionBoy
// Version 1.0
type
TAdobeCipher = array[1..24] of string;
const
// It basically represents the decrypted versions of each char in the key.
// aaaa-bbbb-cccc-dddd-eeee-ffff
AdobeCipher: TAdobeCipher =
// Section A.
('0000000001', '5038647192', '1456053789', '2604371895',
// Section B.
'4753896210', '8145962073', '0319728564', '7901235846',
// Section C.
'7901235846', '0319728564', '8145962073', '4753896210',
// Section D.
'2604371895', '1426053789', '5038647192', '3267408951',
// Section E.
'5038647192', '2604371895', '8145962073', '7901235846',
// Section F.
'3267408951', '1426053789', '4753896210', '0319728564');
var
sAdobeDecryptedKey: string;
i: integer;
begin
// Ensure we're dealing with a key we can support:
if (sAdobeEncryptedKey <> '') and (IsNumeric(sAdobeEncryptedKey, True)) and (Length(sAdobeEncryptedKey) = 24) then
begin
sAdobeDecryptedKey := sAdobeEncryptedKey; // Set length of sAdobeDecryptedKey
// Iterate through each char in the key.
for i := 1 to Length(sAdobeEncryptedKey) do
sAdobeDecryptedKey[i] := adobeCipher[i][(StrToInt(sAdobeDecryptedKey[i]) + 1)];
FormatAdobeKey(sAdobeDecryptedKey);
end
else // We don't understand the format we're given, return empty string.
sAdobeDecryptedKey := 'corrupt serial';
Result := sAdobeDecryptedKey;
end;

Algorithm to decode Adobe keys rewritten in JavaScript.

//Converted from the DecodeAdobeKey function in the Enchanted Keyfinder Source
//By Sam Gleske
//Original algorithm by Dave Hope (http://www.davehope.co.uk)
//http://sf.net/projects/keyfinder
function DecodeAdobeKey(sAdobeEncryptedKey) {
    var regex = /[0-9]{24}/g;
    if(!regex.test(sAdobeEncryptedKey)) {
	return 'corrupted serial';
    }
    var AdobeCipher = new Array(),index=0,sAdobeDecryptedKey='';
    AdobeCipher[index++] = '0000000001';
    AdobeCipher[index++] = '5038647192';
    AdobeCipher[index++] = '1456053789';
    AdobeCipher[index++] = '2604371895';
    AdobeCipher[index++] = '4753896210';
    AdobeCipher[index++] = '8145962073';
    AdobeCipher[index++] = '0319728564';
    AdobeCipher[index++] = '7901235846';
    AdobeCipher[index++] = '7901235846';
    AdobeCipher[index++] = '0319728564';
    AdobeCipher[index++] = '8145962073';
    AdobeCipher[index++] = '4753896210';
    AdobeCipher[index++] = '2604371895';
    AdobeCipher[index++] = '1426053789';
    AdobeCipher[index++] = '5038647192';
    AdobeCipher[index++] = '3267408951';
    AdobeCipher[index++] = '5038647192';
    AdobeCipher[index++] = '2604371895';
    AdobeCipher[index++] = '8145962073';
    AdobeCipher[index++] = '7901235846';
    AdobeCipher[index++] = '3267408951';
    AdobeCipher[index++] = '1426053789';
    AdobeCipher[index++] = '4753896210';
    AdobeCipher[index++] = '0319728564';

    //decode the adobe key
    for(var i = 0; i < 24; i++) {
	if (i%4 == 0 && i>0) {
	    sAdobeDecryptedKey += '-';
	}
	sAdobeDecryptedKey += AdobeCipher[i].charAt( sAdobeEncryptedKey.charAt(i) );
    }
    return sAdobeDecryptedKey;
}