Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big endian #101

Open
williamgoodhew opened this issue Jul 2, 2020 · 2 comments
Open

Big endian #101

williamgoodhew opened this issue Jul 2, 2020 · 2 comments

Comments

@williamgoodhew
Copy link

williamgoodhew commented Jul 2, 2020

Is there a way of ensuring the big-endian network byte order is maintained? I am using the 128 key in ECB.

here is my current code:

    const key = Buffer.from("20572F52364B3F473050415811632D2B", "hex")
    const text = '0x060x010x010x01'
    const textBytes = aesjs.utils.utf8.toBytes(text);
    console.log('textBytes: ', textBytes)

    const aesEcb = new aesjs.ModeOfOperation.ecb(key);
    console.log('aesEcb: ', aesEcb)
    const encryptedBytes = aesEcb.encrypt(textBytes);
    console.log('encryptedBytes: ', encryptedBytes)

    const encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes);
    console.log('encryptedHex: ', encryptedHex);
@timomeara
Copy link

@williamgoodhew
did you ever figure this out?
you're also trying to unlock an eddystone beacon?

@ricmoo
Copy link
Owner

ricmoo commented Jan 22, 2021

Sorry. Just saw this.

I do not use any host ordered objects (i.e. uint32Array) in the code, so network order should always be preserved. More specifically any order should always be preserved as everything is operated on as a binary stream of bytes...

can you include output in your example that have the order change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants