Posts

Showing posts with the label java

Gson's missing get element function - Part I

The Gson missing recursive get function. One of the issues with the current get function that is available is that it only search’s top-level entry key for the value that is passed in. Example JsonObject result; // json object for the preview below If a result.get(“username”) is done the following set will return null because as I have said above the inbuilt get function only search top level element you wish to find. The following values exists in the top-level [“result”, “error”, “id”] the inner elements will not be searched which is part of the flaw / weakness of using the in-built method. A solution to this problem is show below: {     "result" : {         "total_items" : 1 ,         "total_pages" : 1 ,         "items_per_page" : 25 ,         "current_page" : 1 ,    ...

EasyCrypt

EasyCrypt for JavaScript EasyCrypt is a port of an encryption algorithm developed in college. It’s by no means the best or most ideal means of encryption (at least not when compared to RSA, AES, SHA1, Blowfish etc), but it’s a basic encryption algorithm developed for simply showing students and adults alike how to go about writing their own encryption algorithm. The encryption algorithm is equipped with a encrypt/decrypt function. EasyCrypt is a substitution cipher (like ROT13 a simple variant of the Caesar Cipher used by Julius Ceasar to communicate with his generals) The code that will be shown below has the following configuration. Customization var shift = 3 ; var cipher = "@)*%/~^!?z" ; Notice the shift value of 3, which simply means that when the value is converted to character code move it 3 values up. e.g. 72 (H) would be 75 (K). The cipher is used to obfuscate/encrypt the entered text making it useless to an intruder or person with...