Skip to content

double bytes password #477

Closed Answered by nenge123
nenge123 asked this question in Q&A
Jan 22, 2024 · 4 comments · 1 reply
Discussion options

You must be logged in to vote

https://unpkg.com/[email protected]/index.js

demo can make
rawPassword = entry.filenameUTF8==false&&commentEncoding=='gbk'?str2gbk(password):I.encode(password);

function str2gbk(str) {
    const ranges = [
        [0xA1, 0xA9, 0xA1, 0xFE],
        [0xB0, 0xF7, 0xA1, 0xFE],
        [0x81, 0xA0, 0x40, 0xFE],
        [0xAA, 0xFE, 0x40, 0xA0],
        [0xA8, 0xA9, 0x40, 0xA0],
        [0xAA, 0xAF, 0xA1, 0xFE],
        [0xF8, 0xFE, 0xA1, 0xFE],
        [0xA1, 0xA7, 0x40, 0xA0],
    ];
    let codes = new Uint16Array(23940);
    let i = 0;
    for (const [b1Begin, b1End, b2Begin, b2End] of ranges) {
        for (let b2 = b2Begin; b2 <= b2End; b2++) {
            if (b2 !== 0x7F) {
                for 

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@nenge123
Comment options

Answer selected by gildas-lormeau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants