mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
parent
bcc703ebec
commit
be0efbde24
3 changed files with 16 additions and 14 deletions
|
|
@ -159,7 +159,7 @@ object frmMasterKey: TfrmMasterKey
|
|||
Top = 49
|
||||
Width = 161
|
||||
MaxValue = 64
|
||||
MinValue = 2
|
||||
MinValue = 1
|
||||
TabOrder = 1
|
||||
Value = 4
|
||||
end
|
||||
|
|
@ -185,7 +185,7 @@ object frmMasterKey: TfrmMasterKey
|
|||
Height = 25
|
||||
Top = 0
|
||||
Width = 65
|
||||
MaxValue = 1024
|
||||
MaxValue = 2048
|
||||
MinValue = 64
|
||||
TabOrder = 0
|
||||
Value = 64
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ type
|
|||
function Test(Finish: Boolean): Boolean;
|
||||
end;
|
||||
|
||||
function CreateMasterKey(Short: Boolean; out Password: String; out ArgonType: Targon2_type; var M: UInt32; var T, P: UInt16): Boolean;
|
||||
function CreateMasterKey(Short: Boolean; out Password: String; out ArgonType: Targon2_type; out M: UInt32; out T, P: UInt16): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
|
|
@ -52,14 +52,14 @@ implementation
|
|||
uses
|
||||
uLng;
|
||||
|
||||
function CreateMasterKey(Short: Boolean; out Password: String; out ArgonType: Targon2_type; var M: UInt32; var T, P: UInt16): Boolean;
|
||||
function CreateMasterKey(Short: Boolean; out Password: String; out ArgonType: Targon2_type; out M: UInt32; out T, P: UInt16): Boolean;
|
||||
begin
|
||||
with TfrmMasterKey.Create(Application) do
|
||||
try
|
||||
seIterations.Value:= T;
|
||||
seParallelism.Value:= P;
|
||||
seMemory.Value:= 256;
|
||||
seIterations.Value:= 2;
|
||||
seParallelism.Value:= 4;
|
||||
cmbFunction.ItemIndex:= 0;
|
||||
seMemory.Value:= M div 1024;
|
||||
gbMasterKey.Visible:= not Short;
|
||||
pnlButtons.OKButton.Enabled:= Short;
|
||||
pnlButtons.OKButton.ModalResult:= mrNone;
|
||||
|
|
|
|||
|
|
@ -302,18 +302,20 @@ end;
|
|||
|
||||
procedure TPasswordStore.LoadParameters;
|
||||
const
|
||||
ARGON2_MTP = (1 << 17) or (4 << 32) or (4 << 48);
|
||||
ARGON2_TYP: array[0..1] of Targon2_type = (Argon2_d, Argon2_id);
|
||||
var
|
||||
ATemp: TArgon2Params;
|
||||
begin
|
||||
ATemp.Value:= ReadInt64('General', 'Parameters', ARGON2_MTP);
|
||||
FMasterKeyHash:= ReadString('General', 'MasterKey', EmptyStr);
|
||||
// Validate parameters
|
||||
FArgon2.T:= Max(ATemp.T, ARGON2_T);
|
||||
FArgon2.P:= Max(ATemp.P, ARGON2_P);
|
||||
FArgon2.A:= ARGON2_TYP[ATemp.M >> 31];
|
||||
FArgon2.M:= Max(ATemp.M and $7FFFFFFF, ARGON2_M);
|
||||
if (Length(FMasterKeyHash) > 0) then
|
||||
begin
|
||||
ATemp.Value:= ReadInt64('General', 'Parameters', 0);
|
||||
// Validate parameters
|
||||
FArgon2.A:= ARGON2_TYP[ATemp.M >> 31];
|
||||
FArgon2.T:= Min(64, Max(ATemp.T, ARGON2_T));
|
||||
FArgon2.P:= Min(64, Max(ATemp.P, ARGON2_P));
|
||||
FArgon2.M:= Min(2048, Max(ATemp.M and $7FFFFFFF, ARGON2_M));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPasswordStore.SaveParameters;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue