fpspreadsheet: Add new unit fpscrypto.pas.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5787 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2017-03-05 11:44:32 +00:00
parent f4779f63f7
commit ffceb1932b
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,30 @@
unit fpsCrypto;
interface
uses
SysUtils;
function ExcelPasswordHash(const APassword: String): String;
implementation
{@@ This is the code for generating Excel 2010 and earlier password's hash }
function ExcelPasswordHash(const APassword: string): string;
const
Key = $CE4B;
var
i: Integer;
HashValue: Word = 0;
begin
for i:= Length(APassword) downto 1 do
begin
HashValue := ord(APassword[i]) xor HashValue;
HashValue := HashValue shl 1;
end;
HashValue := HashValue xor Length(APassword) xor Key;
Result := IntToHex(HashValue, 4);
end;
end.

View File

@ -30,7 +30,7 @@
This package is all you need if you don't want graphical components (like grids and charts)."/>
<License Value="LGPL with static linking exception. This is the same license as is used in the LCL (Lazarus Component Library)."/>
<Version Major="1" Minor="9"/>
<Files Count="45">
<Files Count="46">
<Item1>
<Filename Value="fps.inc"/>
<Type Value="Include"/>
@ -250,6 +250,10 @@ This package is all you need if you don't want graphical components (like grids
<Filename Value="common\fpssearch.pas"/>
<UnitName Value="fpsSearch"/>
</Item45>
<Item46>
<Filename Value="common\fpscrypto.pas"/>
<UnitName Value="fpsCrypto"/>
</Item46>
</Files>
<i18n>
<EnableI18N Value="True"/>