GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — StringEncrypt-Python/examples/StringEncryptExampleCustom.py at main · PELock/StringEncrypt-Python Expand file tree/ Copy pathStringEncryptExampleCustom.pyMore file actions 96 lines (76 loc) · 2.79 KB / Copy pathStringEncryptExampleCustom.pyFile metadata and controls96 lines (76 loc) · 2.79 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 #!/usr/bin/env python ############################################################################### # # String Encrypt WebApi interface usage example. # # In this example we will encrypt sample strings with custom options. # # Version : v1.0.1 # Language : Python # Author : Bartosz Wójcik # Project page : https://www.stringencrypt.com # Web page : https://www.pelock.com # ############################################################################### # # include StringEncrypt module # from stringencrypt import StringEncrypt # # if you don't want to use Python module, you can import it directly from the file # #from stringencrypt.stringencrypt import StringEncrypt def print_results(result): # # result[] array holds the encryption results as well as other information # # result["error"] (int) - error code # result["error_string"] (string) - error code as a string # result["source"] (string) - decryptor source code # result["expired"] (boolean) - expiration flag # result["credits_left"] (int) - number of credits left # result["credits_total"] (int) - initial number of credits if result and "error" in result: # display source code of the decryption code if result["error"] == StringEncrypt.ErrorCodes.ERROR_SUCCESS: print(result["source"]) else: print(f'An error occurred, error code: {result["error"]} ({result["error_string"]})') else: print("Something unexpected happen while trying to encrypt the string.") # # create StringEncrypt class instance (we are using our activation code) # myStringEncrypt = StringEncrypt("YOUR-API-KEY-HERE") # leave empty for demo mode # # encrypt a string using all the default options # result = myStringEncrypt.encrypt_string("Hello", "label") print_results(result) # # lets change the output programming language into C++ # myStringEncrypt.outputProgrammingLanguage = StringEncrypt.OutputProgrammingLanguages.LANG_CPP result = myStringEncrypt.encrypt_string("C++", "wszLbl") print_results(result) # # change the encoding of the string to ANSI # myStringEncrypt.useUnicode = False result = myStringEncrypt.encrypt_string("ANSI!", "szLbl") print_results(result) # # change to JavaScript language output and see the difference # between local variable encoding and global variable encoding # myStringEncrypt.useUnicode = True myStringEncrypt.outputProgrammingLanguage = StringEncrypt.OutputProgrammingLanguages.LANG_JS myStringEncrypt.declareAsLocalVariable = True result = myStringEncrypt.encrypt_string("Local", "local") print_results(result) # # switch to global variable encoding (if possible for the programming language) # myStringEncrypt.declareAsLocalVariable = False result = myStringEncrypt.encrypt_string("Global", "global") print_results(result) |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |