removed unneeded uint8array conversion
This commit is contained in:
parent
1efa8a0a55
commit
2a3cec050b
File diff suppressed because one or more lines are too long
6
index.js
6
index.js
|
@ -9,9 +9,9 @@ addEventListener('fetch', event => {
|
||||||
const AESKEY = [106, 111, 54, 97, 101, 121, 54, 104, 97, 105, 100, 50, 84, 101, 105, 104]
|
const AESKEY = [106, 111, 54, 97, 101, 121, 54, 104, 97, 105, 100, 50, 84, 101, 105, 104]
|
||||||
|
|
||||||
function str2bin(str) {
|
function str2bin(str) {
|
||||||
return new Uint8Array(Array.from(str).map(function (item) {
|
return Array.from(str).map(function (item) {
|
||||||
return item.charCodeAt(0);
|
return item.charCodeAt(0);
|
||||||
}))
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function url_gen(md5_origin, format, id, media_version) {
|
async function url_gen(md5_origin, format, id, media_version) {
|
||||||
|
@ -19,7 +19,7 @@ async function url_gen(md5_origin, format, id, media_version) {
|
||||||
|
|
||||||
let result = [md5_origin, format, id, media_version].join('\xa4')
|
let result = [md5_origin, format, id, media_version].join('\xa4')
|
||||||
|
|
||||||
let result_md5 = await crypto.subtle.digest('MD5', str2bin(result))
|
let result_md5 = await crypto.subtle.digest('MD5', new Uint8Array(str2bin(result)))
|
||||||
|
|
||||||
result_md5 = aesjs.utils.hex.fromBytes(new Uint8Array(result_md5))
|
result_md5 = aesjs.utils.hex.fromBytes(new Uint8Array(result_md5))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue