sorcerykid / cipher Goto Github PK
View Code? Open in Web Editor NEWSimple Cipher is a lightweight and portable cryptography library for Minetest.
Simple Cipher is a lightweight and portable cryptography library for Minetest.
Simple Cipher Mod v1.1 By Leslie E. Krause Simple Cipher is a lightweight and portable cryptography library providing a minimal degree of security for non mission-critical data (e.g. unique, non-guessable URLs). Also included is a pure Lua-adaptation of XTEA, a public domain block-cipher algorithm designed by Needham and Wheeler in 1997. The following library functions are available: cipher.get_checksum( str, method ) Calculates and returns the numeric hash of the string using one of these methods: o "fletcher64" for the Fletcher-64 algorithm o "fletcher32" for the Fletcher-32 algorithm o "fletcher16" for the Fletcher-16 algorithm o "adler32" for the Adler-32 algorithm (default) cipher.tokenize( hash ) Given a numeric hash, this function generates and returns a token consisting only of letters in the alphabet soup. This is primary useful for generating short-URLs, in which the hash corresponds to a unique key within a database of site redirects. cipher.generate_key( username, password ) Generates and returns a 128-bit public/private key pair for use with either of the cryptography functions described below. This key is intended only for encrpytion and decryption, and should NEVER be shared under any circumstances. If a password is not provided, then the value of `cipher.password` will be used by default. cipher.encrypt( num, str, key ) Encrypts the string using the XTEA block-cipher and returns the ciphertext. The key should be generated by `cipher.generate_key`, and an appropriate number of rounds chosen to mitigate against attacks (32 or more is recommended, 64 is maximum). cipher.decrypt( str, key ) Decrypts the string that was previously encrypted by `cipher.encrypt()` with the same key generated by `cipher.generate_key`. The enrypted string will be checked both for proper length and valid header prior to decryption. cipher.encrypt_to_base64( str, username ) This is a convenience function for encryption of a string with just a username. It returns a Base-64 string representation of the ciphertext. cipher.decrypt_from_base64( str, username ) This is the inverse of `cipher.encrypt_to_base64`, and therefore expects a Base-64 string representation of the ciphertext as well as the original username. Before you begin, it is important that you customize the alphabet soup that will be used by the tokenizer. Likewise, if you intend to use the XTEA block-cipher, then a password needs to be set. Both variables can be found at the head of the `init.lua` file. Dependencies ---------------------- Bitwise Operators Mod (required) https://bitbucket.org/sorcerykid/bitwise Source Code License ---------------------- MIT License Copyright (c) 2016-2020, Leslie E. Krause. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more details: https://opensource.org/licenses/MIT
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.