Download the PHP package duzun/cycle-crypt without Composer

On this page you can find all versions of the php package duzun/cycle-crypt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cycle-crypt

cycle-crypt codecov

Variable size symmetric key encryption algorithm.

PHP & JavaScript implementation, small, portable and fast.

The cipher-key is generated by cycling the input key with a variation of XorShift+ random number generator. The bigger the key-size, the longer the period.

Install

PHP

JS

Browser

Usage

Here is an example of encrypting on server and decrypting on client, salt auto-generated.

PHP:

Express.js:

Browser:

It is also possible to do the reverse: encrypt on client and decrypt on server.

You can also use your salt:

On the JS end, message is an instance of Uint8Array with a custom .toString(encoding), where encoding is one of 'binary', 'hex', 'base64', 'utf8' or undefined (guess).

For older browsers you should use a DataView polyfill.

Encrypt in chunks

Here is an example of encrypting a big file in small chunks, thus avoid using lots of memory.

You don't have to write the code to encrypt a file for yourself, cause there is a CLI for that:

Node.js

PHP

Note: The Node.js CLI version is much faster than the PHP one.

CLI Usage

cycle-crypt -k <key> [-s <salt> | -si <salt_in> | -so <salt_out>] [-sr <salt_rounds>] [-i <file_in>] [-o <file_out>]
cycle-crypt -h|--help

-h, --help      Show this help
-k, --key       The encryption key. Could be hex if starts with '0x'.
-s, --salt      Random bytes to be used as salt. Could be hex if starts with '0x'.
                Can contain the salt-rounds as "0x<salt_in_hex>x<salt_rounds>".
-si, --salt-in  Filename or - from where to read the salt.
-so, --salt-out Filename or - where to output the generated salt.
-sr, --salt-rounds Number of rounds of initial state generated from salt + key
-i, --in        Input file to encrypt or - for STDIN
-o, --out       Output file or - for STDOUT

You can not combine -s and -si, use just one of them.    

-i and -o default to -

Warning!

If you deal with a security critical application, please consider using one of the NIST approved standard encryption algorithms like AES.

If you don't trust any encryption algorithm, here is a hint:

Choose two or more ciphers C1, C2 ... Cn from two or more vendors.

When ciphering the message M with C = M ^ C1 ^ C2 ^ ... ^ Cn, the secrecy of the cipher-text C is not worse than the best of Ci.

In other words, it can't hurt the secrecy when xoring more independent ciphers.

The theory behind this property is analysed and proven in my Masters Thesis:

The sum c = r1 ⊕ r2 ⊕ ... ⊕ rm, where c, ri ∊ 𝔹k (string of bits of length k), i=1,m, is a perfect secret if and only if there is at least one ri perfect secret and the operation ⊕ is a cryptographic safe operation.

To Do

The JS version uses Uint32Array and Uint8Array, which use little endian or big endian, depending on hardware. The current implementation has been tested in little endian HW only!

Have to implement the alternative to big endian too.

link


All versions of cycle-crypt with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package duzun/cycle-crypt contains the following files

Loading the files please wait ....