Delphi写的算法
function CalCode(name: string): string;
var
i, k: Integer;
begin
Result := '';
name := UpperCase(name);
for i:=1 to Length(name) do
begin
if i<Length(name) then
k := Ord(name[i+1])
else
k := Ord(name[2]);
Result := Result + Chr((k-2-1)*2+2-Ord(name[i]));
end;
end;