[英]convert char to char such as encryption
如何進行簡單的加密解密?
2個make make box和一個項目中的按鈕,然后我在editbox1
編寫一些editbox1
,然后在editbox2
按button1
在此類設置中生成一些鍵。
a:= 1; b:= 2; c:= 3; d:= 4; e:= 5; f:= 6; g:= 7; h:= 8; i:= 9; j:= 0; k:=#; l:= $; m:=%; n:=〜; o:= *;
然后用符號說
a: = 1;
這意味着: a is 1 if at editbox2
字母(A)是數字1的子項(B)是數字2的子項(C)是數字3的簡單轉換.. 因此,請進行簡單的替換密碼和解密
這是一個簡單的替換密碼
const
CPlain = 'abcdefghijklmno';
CCrypt = '1234567890#$%~*';
function Transcode( const AStr, ALookupA, ALookupB : string ): string;
var
LIdx, LCharIdx : integer;
begin
// the result has the same length as the input string
SetLength( Result, Length( AStr ) );
// walk through the whole string
for LIdx := 1 to Length( AStr ) do
begin
// find position of char in LookupA
LCharIdx := Pos( AStr[LIdx], ALookupA );
// use the char from LookupB at the previous position
Result[LIdx] := ALookupB[LCharIdx];
end;
end;
function Encrypt( const AStr : string ) : string;
begin
// from plain text to crypt text
Result := Transcode( AStr, CPlain, CCrypt );
end;
function Decrypt( const AStr : string ) : string;
begin
// from crypt text to plain text
Result := Transcode( AStr, CCrypt, CPlain );
end;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.