加密的密码如何使用(100分)

L

LuJuhe

Unregistered / Unconfirmed
GUEST, unregistred user!
中软的ODPS公文处理系统,它的密码是经过加密的,字段类型为varbinary,长度32位。
我想做一个web版的公文查询系统,希望利用它的密码体系,但是不知道是什么算法。
有点像MD5,但是好像还的要一个密钥才能利用吧?
以下是一些数据:
密码为"lujuhe"时:
0xC2CDC0CCF4DEF8DDBEC2E8A5B3E5B9D1B0E7E9A4E3B8B4EFB6D0AEE0FFE5FDF8F2D7E1D3
密码为空时密文也不一样,以下时其中两个空密码:
0xB3DCAFE3C4CFBEC2B1E6E5BFDEB6E6A6C7CCDEB6B0E4E9A7AAF8BEC3BDD8B4ECAEE3ABF5
0xE4A8C1C7B2E8B6D0DEB6EDACC2CBBDD8E6A1EBABA8F7A7F2B5EEC3C4BFDCC2CABDD9E1B4
 
算了吧
那系统应该有两个函数,一个加密,一个解密,没有解密是不行的
 
例:但要知道,密钥
加密函数
encrypt(string,key)得加密结果
解密函数
encrypt(string,key)得解密结果
 
我并不是要破解密码,而是想利用它的权限系统而已。
只要知道encrypt(password,key)是用的什么算法,其中的key应该是和用户名、代码之类的
相关的,问题就是这个encrypt是 MD5还是其它的什么???
 
首先感谢你的回复(Active Form 的Web Deployment option中Target URL 项能不能动态
设置),我这里有一段代码或许对你有帮助,我只需要你的e-mail,可以吗?如果行,
请把你的e-mail地址发到wcany@sina.com,以便今后再次请教!!!
加密解密算法代码:

unit Cl_crypt32;
{
*************************************************************************
*名称: Cl_crypt32.pas*
*说明: Cl_crypt32.pas为一支编解码模组,乃修改『Martin Djern犘』先生所修改
* 的《crypt32.pas 32 bits encode/decode module》而成(修改的理由请详
* 见下述)。
*
*函数原型: function cl_encrypt(s:string):string;
* function cl_decrypt(s:string):string;*
*使用方法: 《编码》encrypted:=cl_encrypt('password');
* 《解码》decrypted:=cl_decrypt(encrypted);*
*注意: 使用时,请先修改cl_crypt32.pas内StartKey,MultKey,AddKey三个key值。
* (其中startkey的值最好不要小於256)。
*
*修改的理由: 仅管『Martin Djern犘』先生的《crypt32.pas 32 bits encode/decode module》
* 已经很好用,但是我在实际应用时,却发现下列的问题:
* 1.无法把编码後的字串指定给edit元件。
* 2.无法把编码後的字串存放在.ini档内。
* 上述两点可以举下例两个例子证明:
* (例一〉
* edit1.text:=Encrypt('password',StartKey,MultKey,AddKey);
* edit2.text:=decrypt(edit1.text,StartKey,MultKey,AddKey);
* 结果: edit2.text的内容不等於'password'
* (例二)
* var
* IniFile: TIniFile;
* begin
* IniFile := TIniFile.Create('test.INI');
* IniFile.WriteString('demo', 'password', Encrypt('password',StartKey,MultKey,AddKey));
* IniFile.Free;*
* IniFile := TIniFile.Create('test.INI');
* edit2.text:=decrypt(IniFile.readString('demo', 'password', ''),StartKey,MultKey,AddKey);
* IniFile.Free;
* 结果: edit2.text的内容不等於'password'
* 上述两种情况的发生原因,大概是因为编码後的字元码大於127,
* 因此无法被『具有处理文字型态能力的元件』正确处理。
* 基於上述理由,我把它修改了一下,并加上以系统时间值为参数,
* 使其编码後的值可以成功存放在edit.text及.ini files内。
*
*修改者: cloudy@tpts4.seed.net.tw
**************************************************************************
}
{
*************************************************************************
* Name: Crypt32.Pas *
* Description: 32 bits encode/decode module *
* 2^96 variants it is very high to try hack *
* Purpose: Good for encrypting passwors and text *
* Security: avoid use StartKey less than 256 *
* if it use only for internal use you may use default *
* key, but MODIFY unit before compiling *
* Call: Encrypted := Encrypt(InString,StartKey,MultKey,AddKey) *
* Decrypted := Decrypt(InString,StartKey) *
* Parameters: InString = long string (max 2 GB) that need to encrypt *
* decrypt*
* MultKey = MultKey key *
* AddKey = Second key *
* StartKey = Third key *
* (posible use defaults from interface) *
* Return: OutString = result string *
* Editor: Besr viewed with Tab stops = 2, Courier new *
* Started: 01.08.1996 *
* Revision: 22.05.1997 - ver.2.01 converted from Delphi 1 *
* and made all keys as parameters, before only start key *
* Platform: Delphi 2.0, 3.0 *
* work in Delphi 1.0, 2^48 variants, 0..255 strings *
* Author: Anatoly Podgoretsky *
* Base alghoritm from Borland *
* Address: Vahe 4-31, Johvi, Estonia, EE2045, tel. 61-142 *
* kvk@estpak.ee *
* Status: Freeware, but any sponsor help will be appreciated here *
* need to buy books, shareware products, tools etc *
*************************************************************************
* Modified: Supports Delphi 1.0 & 2.0 *
* Overflow checking removed *
* By: Martin Djern犘 *
* e-mail: djernaes@einstein.ot.dk *
* web: einstein.ot.dk/~djernaes *
*************************************************************************
}
interface

uses
SysUtils;

const
StartKey = 71328; {Start default key}
MultKey = 88217737; {Mult default key}
AddKey = 88217767; {Add default key}

function cl_encrypt(s:string):string;
function cl_decrypt(s:string):string;

//function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
//function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;

implementation

{$R-}
{$Q-}
{*******************************************************
* Standard Encryption algorithm - Copied from Borland *
*******************************************************}
function Encrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString) xor (StartKey shr 8));
StartKey := (Byte(Result) + StartKey) * MultKey + AddKey;
end;
end;
{*******************************************************
* Standard Decryption algorithm - Copied from Borland *
*******************************************************}
function Decrypt(const InString:string; StartKey,MultKey,AddKey:Integer): string;
var
I : Byte;
begin
Result := '';
for I := 1 to Length(InString) do
begin
Result := Result + CHAR(Byte(InString) xor (StartKey shr 8));
StartKey := (Byte(InString) + StartKey) * MultKey + AddKey;
end;
end;
{$R+}
{$Q+}

{Coded by cloudy}
Function cl_intto0str(int1:integer; len:integer):string;
var
i,j:integer;
begin
if length(inttostr(int1))>=len then
result:=inttostr(int1)
else
begin
result:='';
i:=len-length(inttostr(int1));
for j:=1 to i do result:=result+'0';
result:=result+inttostr(int1);
end;
end;

{Coded by cloudy}
function cl_chartobytestr(s:string):string;
var
i:byte;
begin
result:='';
for i:=1 to length(s) do
result:=result+cl_intto0str(byte(s),3);
end;

function cl_bytetocharstr(s:string):string;
var
i:integer;
begin
i:=1;
result:='';
if (length(s) mod 3)=0 then
while i<length(s) do
begin
result:=result+char(strtoint(copy(s,i,3)));
i:=i+3;
end;
end;

{Coded by cloudy}
function cl_encrypt(s:string):string;
var
years, months, days, hours, mins, secs, msec:word;
cl_StartKey, cl_MultKey, cl_AddKey: longint;

begin
decodedate(now, years, months, days);
decodetime(now, hours, mins, secs, msec);
cl_StartKey:=msec;
if cl_StartKey<256 then cl_StartKey:=cl_StartKey+256;
cl_Multkey:=((years-1900)*12+months)*30+days+cl_StartKey*10+cl_StartKey;
cl_AddKey:=(23*hours+mins)*60+secs+cl_StartKey*10+cl_StartKey;
result:=cl_chartobytestr(Encrypt(cl_intto0str(cl_StartKey,3),StartKey,MultKey,AddKey))+cl_chartobytestr(Encrypt(cl_intto0str(cl_Multkey,5),StartKey,MultKey,AddKey))+cl_chartobytestr(Encrypt(cl_intto0str(cl_Addkey,5),StartKey,MultKey,AddKey))+cl_chartobytestr(Encrypt(s,cl_StartKey,cl_MultKey,cl_AddKey));
end;

{Coded by cloudy}
function cl_decrypt(s:string):string;
var
cl_StartKey, cl_Multkey, cl_AddKey:longint;
begin
cl_StartKey:=strtoint(decrypt(cl_bytetocharstr(copy(s, 1, 9)),StartKey,MultKey,AddKey));
cl_MultKey:=strtoint(decrypt(cl_bytetocharstr(copy(s, 10, 15)),StartKey,MultKey,AddKey));
cl_AddKey:=strtoint(decrypt(cl_bytetocharstr(copy(s, 25, 15)),StartKey,MultKey,AddKey));
result:=decrypt(cl_bytetocharstr(copy(s, 40, length(s)-39)),cl_StartKey,cl_MultKey,cl_AddKey);
end;


end.

 
加密的算法我用DCP_Crypt组件,里面有很多种算法了,
但现在的问题是,这个密文不知道是用什么算法加密的。。。

我的email: webmaster@xxtax.gov.cn
 
过年了,结束。。。
 
顶部