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

Databuffer.PeekString issue #456

Open
jondecker76 opened this issue Jan 17, 2019 · 1 comment
Open

Databuffer.PeekString issue #456

jondecker76 opened this issue Jan 17, 2019 · 1 comment

Comments

@jondecker76
Copy link

Please see forum post here:
http://monkeycoder.co.nz/forums/topic/help-porting-hmac-sha256-code/#post-15930

String characters $80 to $FE are returned as $FF80 to FFFE. There is no $FF character at all, and $00 is returned. This makes any type of string based encryption/hashing very difficult. Is this a bug?

@D-a-n-i-l-o
Copy link
Contributor

D-a-n-i-l-o commented Jan 17, 2019

Strings in Monkey2 support Unicode and each Character uses 16Bit = 2 Bytes.

Your code looks to me like you assume ASCII-Strings?

Maybe there should be some more PeekString() functions to catch different String representations from DataBuffer.

DataBuffer.PeekString(offset, count, StringFormat.ASCII )
DataBuffer.PeekString(offset, count, StringFormat.UTF8 )
DataBuffer.PeekString(offset, count, StringFormat.UTF16 )
...

Currently it looks like PeekString() indeed catches ASCII chars, but that would be wrong imo.

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

2 participants