Top-rated recipes tagged "encode"http://code.activestate.com/recipes/tags/encode/top/2013-10-24T11:31:44-07:00ActiveState Code RecipesMarkov Encryption Demonstration 1 (Python) 2012-03-16T18:59:06-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578062-markov-encryption-demonstration-1/ <p style="color: grey"> Python recipe 578062 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/demonstration/">demonstration</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/encoding/">encoding</a>, <a href="/recipes/tags/encrypt/">encrypt</a>, <a href="/recipes/tags/encryption/">encryption</a>). </p> <p>This is a simple GUI program that shows Markov Encryption at work. It is built to be interactive and has all needed code embedded within itself. This version of ME library is not very efficient and represents an early attempt at developing and easily testing the code. Certain limits are built into the program, and the code is not meant to be robust at this stage. This program is a proof-of-concept design meant to ensure that the work being done was viable for future use and that the encryption process could be carried out both ways, both in encoding plaintext and decoding ciphertext.</p> Novel JavaScript Text Compressor (JavaScript) 2011-01-31T15:41:36-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577557-novel-javascript-text-compressor/ <p style="color: grey"> JavaScript recipe 577557 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/compression/">compression</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/encryption/">encryption</a>). </p> <p>Compression, encryption, and data codecs are all related fields that most programmers will use ready-made solutions for. This recipe is a shallow adventure into the writing of original code and algorithms that explores a combination of those topics. Based on the work of <a href="http://code.activestate.com/recipes/577433/">recipe 577433</a>, the code here is compliant with JavaScript and will run a test of itself when executed. From the program's report, one can gather that the novel procedures compress the source and accurately decompress it again. For those who wish to experiment further with the concept, note that fewer unique characters will yield higher compression ratios.</p> <p>To get a copy of <em>biginteger.js</em> for the program to run and compression algorithm to operator, please go to <a href="http://silentmatt.com/biginteger/" rel="nofollow">http://silentmatt.com/biginteger/</a> and use the latest version of Matthew Crumley's excellent JavaScript big integer library.</p> Perl URL encode and decode (Perl) 2010-11-02T17:52:46-07:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/577450-perl-url-encode-and-decode/ <p style="color: grey"> Perl recipe 577450 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/decode/">decode</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/url/">url</a>). </p> <p>URL encode and decode functions for Perl.</p> safe print (Python) 2009-01-02T15:40:30-08:00Trent Mickhttp://code.activestate.com/recipes/users/4173505/http://code.activestate.com/recipes/576602-safe-print/ <p style="color: grey"> Python recipe 576602 by <a href="/recipes/users/4173505/">Trent Mick</a> (<a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/safe/">safe</a>, <a href="/recipes/tags/unicode/">unicode</a>). </p> <p>A replacement for "print" that will safely handle unicode conversion.</p> dynamically changing encoder (for json) with metaclass (class factory) (Python) 2013-10-24T11:31:44-07:00-http://code.activestate.com/recipes/users/4188267/http://code.activestate.com/recipes/578696-dynamically-changing-encoder-for-json-with-metacla/ <p style="color: grey"> Python recipe 578696 by <a href="/recipes/users/4188267/">-</a> (<a href="/recipes/tags/class_factory/">class_factory</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/json/">json</a>, <a href="/recipes/tags/metaclass/">metaclass</a>, <a href="/recipes/tags/metaclasses/">metaclasses</a>). </p> <p>The <em>json.dumps</em> need to be feed with some class (cls =someClass) but what if we want to change the class dynamically? This example can be done by declaring the <em>listOfClasses</em> in class level of course, but the idea is to be changeable. This can be done by the class factory function <em>encoderFacory</em></p> Markov Encryption Demonstration 2 (Python) 2012-03-14T17:39:17-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578076-markov-encryption-demonstration-2/ <p style="color: grey"> Python recipe 578076 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/demo/">demo</a>, <a href="/recipes/tags/demonstration/">demonstration</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/encoding/">encoding</a>, <a href="/recipes/tags/encrypt/">encrypt</a>, <a href="/recipes/tags/encryption/">encryption</a>). </p> <p>This program is meant to act as an example of how to use ME with data that needs to be obfuscated. The functionality provided via the GUI demonstrates both the ability to encrypt and decrypt all text that the UTF-8 encoding can handle. Explanations come later.</p> Text Compressor 3.1 (Python) 2010-10-20T00:50:15-07:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577433-text-compressor-31/ <p style="color: grey"> Python recipe 577433 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/compression/">compression</a>, <a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/encryption/">encryption</a>). </p> <p>Compression, encryption, and data codecs are all related fields that most programmers will use ready-made solutions for. This recipe is a shallow adventure into the writing of original code and algorithms that explores a combination of those topics. Based on the work of <a href="http://code.activestate.com/recipes/502202/">recipe 502202</a>, the code here is compliant with Python 3.1 and will run a test of itself when executed. From the program's report, one can gather that the novel procedures compress the source and accurately decompress it again. For those who wish to experiment further with the concept, note that fewer unique characters will yield higher compression ratios.</p> Rot13 Quine (Python) 2009-04-22T10:05:34-07:00Daniel Lepagehttp://code.activestate.com/recipes/users/4160089/http://code.activestate.com/recipes/576724-rot13-quine/ <p style="color: grey"> Python recipe 576724 by <a href="/recipes/users/4160089/">Daniel Lepage</a> (<a href="/recipes/tags/encode/">encode</a>, <a href="/recipes/tags/quine/">quine</a>). </p> <p>A Quine is a program that, when run, prints its own source code (without resorting to easy solutions like reading its code from the filesystem). The rot13 encoding maps every letter 13 places forwards in the alphabet (wrapping around the end and preserving case). Just for fun, I wrote a quine in the rot13 encoding.</p>