-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Getting encoded hash from the path
rribou edited this page Nov 28, 2019
·
5 revisions
If you want to find the hash in a script, it can be obtained with the following code. (In the case of a standard hashing method)
JavaScript (No support for IE8, IE9)
var volumeId = 'l1_';
var path = 'path/to/target'; // without root path
//var path = 'path\\to\\target'; // use \ on windows server
var hash = volumeId + btoa(unescape(encodeURIComponent(path)))
.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '.')
.replace(/\.+$/, '');
PHP
$volumeId = 'l1_';
$path = 'path/to/target'; // without root path
//$path = 'path\\to\\target'; // use \ on windows server
$hash = $volumeId . rtrim(strtr(base64_encode($path), '+/=', '-_.'), '.');