encrypt download url

This commit is contained in:
xiaomlove
2021-06-01 23:33:28 +08:00
parent 87817de415
commit 0852509084
5 changed files with 55 additions and 4 deletions

View File

@@ -254,4 +254,23 @@ class TorrentRepository extends BaseRepository
return "$speed/s";
}
public function encryptDownHash($id, $uid): string
{
$toolRep = new ToolRepository();
$payload = [
'id' => $id,
'uid' => $uid,
'date' => date('Ymd'),
];
return $toolRep->getEncrypter()->encrypt($payload);
}
public function decryptDownHash($downHash)
{
$toolRep = new ToolRepository();
return $toolRep->getEncrypter()->decrypt($downHash);
}
}