Refactor encodePassword function to improve password encoding
This commit is contained in:
parent
50c33eb172
commit
8ce77400d6
|
@ -1,11 +1,12 @@
|
||||||
export function encodePassword(password: string): string {
|
export function encodePassword(password: string): string {
|
||||||
let newPassword = ''
|
let newPassword = ''
|
||||||
password = '"' + password + '"'
|
|
||||||
for (let i = 0; i < password.length; i++) {
|
for (let i = 0; i < password.length; i++) {
|
||||||
newPassword += String.fromCharCode(
|
newPassword += String.fromCharCode(
|
||||||
password.charCodeAt(i) & 0xff,
|
password.charCodeAt(i) & 0xff,
|
||||||
(password.charCodeAt(i) >>> 8) & 0xff
|
(password.charCodeAt(i) >>> 8) & 0xff
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return newPassword
|
|
||||||
|
return `"${newPassword}"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user