incremental upload refactor
This commit is contained in:
parent
dd703b228a
commit
28498af6d5
4 changed files with 160 additions and 139 deletions
26
frontend/src/utils.js
Normal file
26
frontend/src/utils.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
function ivToStr(iv) {
|
||||
let hexStr = '';
|
||||
for (let i in iv) {
|
||||
if (iv[i] < 16) {
|
||||
hexStr += '0' + iv[i].toString(16);
|
||||
} else {
|
||||
hexStr += iv[i].toString(16);
|
||||
}
|
||||
}
|
||||
window.hexStr = hexStr;
|
||||
return hexStr;
|
||||
}
|
||||
|
||||
function strToIv(str) {
|
||||
let iv = new Uint8Array(16);
|
||||
for (let i = 0; i < str.length; i += 2) {
|
||||
iv[i / 2] = parseInt(str.charAt(i) + str.charAt(i + 1), 16);
|
||||
}
|
||||
|
||||
return iv;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ivToStr,
|
||||
strToIv
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue