mirror of
https://github.com/kvazar-network/crypto-php.git
synced 2025-09-08 20:21:48 +00:00
39 lines
666 B
PHP
39 lines
666 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Kvazar\Crypto;
|
|
|
|
class Hash
|
|
{
|
|
public static function sha256(string $data, $raw = true): string
|
|
{
|
|
return hash(
|
|
'sha256',
|
|
$data,
|
|
$raw
|
|
);
|
|
}
|
|
|
|
public static function sha256d(string $data): string
|
|
{
|
|
return hash(
|
|
'sha256',
|
|
hash(
|
|
'sha256',
|
|
$data,
|
|
true
|
|
),
|
|
true
|
|
);
|
|
}
|
|
|
|
public static function ripemd160(string $data, $raw = true): string
|
|
{
|
|
return hash(
|
|
'ripemd160',
|
|
$data,
|
|
$raw
|
|
);
|
|
}
|
|
} |