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

[php] Wrong addbytes for BytesBuffer #11369

Open
flashultra opened this issue Nov 10, 2023 · 0 comments
Open

[php] Wrong addbytes for BytesBuffer #11369

flashultra opened this issue Nov 10, 2023 · 0 comments

Comments

@flashultra
Copy link
Contributor

The code below will return for Eval target:

1) Ki: 36363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636
2) Ki: 3636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363600000001

but will give wrong result for php:

1) Ki: 36363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636
2) Ki: 00000001

Here is the example:

		var Ki = new haxe.io.BytesBuffer();
		var msg = Bytes.ofHex("00000001");
		var key = Bytes.ofHex("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
		for (i in 0...key.length) {
			Ki.addByte(key.get(i) ^ 0x36);
		}
		trace("1) Ki: "+Ki.getBytes().toHex());
		Ki.add(msg);
		trace("2) Ki: "+Ki.getBytes().toHex());

Tested on Haxe 4.3.1

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

1 participant