Skip to content

Fix encoding bug: replace Encoding.ASCII with Encoding.Latin1#2

Open
carlbennett wants to merge 1 commit intodevelopfrom
feature/bugfix-encoding
Open

Fix encoding bug: replace Encoding.ASCII with Encoding.Latin1#2
carlbennett wants to merge 1 commit intodevelopfrom
feature/bugfix-encoding

Conversation

@carlbennett
Copy link
Copy Markdown
Member

Summary

  • Battle.net protocol specifies ISO 8859-1 (Latin1) for string fields
  • Encoding.ASCII silently corrupts bytes above 0x7F to ? before hashing, causing auth failures for extended characters
  • Fixed in NLS, OldAuth, DataBuffer, DataReader, and all protocol string helpers

Test plan

  • Auth with usernames/passwords containing extended Latin1 characters
  • Protocol string fields round-trip correctly

🤖 Generated with Claude Code

@carlbennett carlbennett force-pushed the feature/bugfix-encoding branch from 34c24b2 to f30881d Compare March 31, 2026 14:08
Battle.net protocol specifies ISO 8859-1 (Latin1) for string fields. Using
ASCII silently corrupts any byte above 0x7F to '?' before hashing or
transmission, causing auth failures for users with extended characters.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@carlbennett carlbennett force-pushed the feature/bugfix-encoding branch from f30881d to 58493c2 Compare March 31, 2026 14:09
@carlbennett
Copy link
Copy Markdown
Member Author

Verified: usernames with extended Latin1 characters exist in the wild. @islanti maintains a cache of Battle.net usernames (illys_list.html) collected from USEast, USWest, Europe, and Asia realms, and scanning it confirms bytes above 0x7F appear in real accounts. Encoding.ASCII would silently corrupt those to ? before hashing, producing a wrong hash and failing auth. This fix is necessary for correct behavior.

$ cat illys_list.html | od -An -tu1 | tr ' ' '\n' | grep -v '^$' | sort -n | uniq -c | sort -rn | awk '{printf "dec=%3d (0x%02X): %d\n", $2, $2, $1}' | grep -v '0x[0-6].' | grep -v '0x7[0-F]'
dec=198 (0xC6): 1
dec=179 (0xB3): 1
dec=154 (0x9A): 1
dec=128 (0x80): 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

Successfully merging this pull request may close these issues.

1 participant