Created
November 7, 2019 04:53
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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