Skip to content

Instantly share code, notes, and snippets.

@Plazmaz
Created November 7, 2019 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Plazmaz/4a94da3f5e7cdc3c385d180d0d43f447 to your computer and use it in GitHub Desktop.
Save Plazmaz/4a94da3f5e7cdc3c385d180d0d43f447 to your computer and use it in GitHub Desktop.
This is what JetBrains uses(used?) for encoding webServers.xml and other configs
# Source file:
# http://git.jetbrains.org/?p=idea/community.git;a=blob_plain;f=platform/platform-api/src/com/intellij/openapi/util/PasswordUtil.java;hb=HEAD
# PasswordUtil.decodePassword
def decode_jebtrains(encoded):
out = ''
for i in range(0, len(encoded), 4):
out += chr(int(encoded[i:i+4], 16) ^ 57258)
return out
# PasswordUtil.encodePassword
def encode_jebtrains(password):
out = ''
for i in range(0, len(password)):
out += hex(ord(password[i]) ^ 57258).replace('0x', '')
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment