Skip to content

Instantly share code, notes, and snippets.

@LeoCx1000
Created February 18, 2025 01:29
Show Gist options
  • Save LeoCx1000/5a723ab81699d5f61c929ffdfd3e9108 to your computer and use it in GitHub Desktop.
Save LeoCx1000/5a723ab81699d5f61c929ffdfd3e9108 to your computer and use it in GitHub Desktop.
3y3 encoding in python because why not.
def encode_3y3(text: str) -> str:
"""Encodes a string using invisible 3y3 encoding."""
return ''.join([chr((val := ord(c)) + (0xE0000 if 0x00 < val < 0x7F else 0)) for c in text])
def decode_3y3(text: str) -> str:
"""Converts all 3y3 text within the string into normal text."""
return ''.join([chr((val := ord(c)) - (0xE0000 if 0xE0000 < val < 0xE007F else 0)) for c in text])
def has_3y3(text: str) -> bool:
"""Detects if a string contains 3y3 encoded text."""
return any(0xE0000 < ord(c) < 0xE007F for c in text)
# License: https://unlicense.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment