Skip to content

Commit

Permalink
skip hash for strlen for defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
deemru committed Nov 5, 2024
1 parent 902202d commit edee2af
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Cryptash.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ public function __construct( $psw, $ivsz = 4, $macsz = 4, $hash = 'sha256' )
$this->psw = $psw;
$this->hash = $hash;
$this->ivsz = max( 0, $ivsz );
$this->cbcsz = strlen( hash( $this->hash, '', true ) );
switch( $hash )
{
case 'sha256': $this->cbcsz = 32; break;
case 'sha512': $this->cbcsz = 64; break;
default: $this->cbcsz = strlen( hash( $this->hash, '', true ) );
}
$this->macsz = min( $macsz, $this->cbcsz );
}

Expand Down

0 comments on commit edee2af

Please sign in to comment.