pq-ntru


Namepq-ntru JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/protdos/pq-ntru
SummaryA quantum proof (post-quantum) implementation of the NTRU algorithm
upload_time2023-03-25 12:16:39
maintainer
docs_urlNone
authorCodingLive | ProtDos
requires_python
license
keywords python python3 post-quantum ntru quantum-proof crypto cryptography lattice svp numpy sympy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Quantum-Proof NTRU Algorithm in Python



## General Overview



This is a Python implementation of the NTRUEncrypt algorithm, which is a lattice-based public key encryption scheme that is believed to be resistant to attacks by quantum computers. The implementation is based on the NTRU Prime 4591 parameter set, which provides a security level of approximately 128 bits. The purpose of this implementation is to provide a quantum-proof encryption scheme that can be used to secure sensitive data.



## Requirements



The implementation requires the following Python packages:



- NumPy

To install these packages, you can use the following command:

```

pip install numpy sympy

```

You can install it with the reuirements too:

```

pip install -r requirements.txt

```



## PyPi Usage

This project can be installed with pip for easy usage.



### Installation

```pip install pq-ntru```



### Usage

```

import pq_ntru



pq_ntru.generate_keys("key_filename", mode="moderate")

enc = pq_ntru.encrypt("key_filename", "message")

dec = pq_ntru.decrypt("key_filename", enc)

```



## Other Usage



To use the implementation, you can import the ntru module and use the encrypt and decrypt functions to encrypt and decrypt messages, respectively.

```

git clone https://github.com/protdos/pq-ntru

```



```

import NTRU2



NTRU2.generate_keys("test", mode="moderate")

enc = NTRU2.encrypt("test", "hello world")

dec = NTRU2.decrypt("test", enc)

print("Decrypted message:", dec)

```



## Implementation Details



The implementation is based on the NTRU Prime 4591 parameter set, which uses a polynomial ring with coefficients in the finite field Z/4591Z. The encryption and decryption algorithms use the NTRU lattice-based encryption scheme, which involves computing a polynomial that is close to a certain lattice point.



The implementation uses the following steps for encryption:



Convert the message to a polynomial with coefficients in the range [-1, 1].

Generate a random polynomial with coefficients in the range [-1, 1] and compute its inverse modulo a certain polynomial.

Compute the product of the message polynomial and the inverse polynomial modulo a certain polynomial, resulting in a new polynomial.

Add noise to the new polynomial to obtain the ciphertext polynomial.

The implementation uses the following steps for decryption:



Compute the product of the ciphertext polynomial and the private key polynomial modulo a certain polynomial, resulting in a new polynomial.

Recover the message polynomial by computing the inverse of the new polynomial modulo a certain polynomial.



## Basic Info over NTRU



NTRUEncrypt is a public key cryptosystem that is based on the mathematical problem of finding a short vector in a lattice. It is believed to be resistant to attacks by quantum computers due to its use of lattice-based cryptography. The security of the system is based on the difficulty of finding short vectors in the lattice, which is a problem that is believed to be hard even for quantum computers.



NTRU was first proposed in 1996 by Hoffstein, Pipher, and Silverman. Since then, several variants of the algorithm have been proposed, including NTRUEncrypt and NTRU Signature. NTRUEncrypt is used for public key encryption, while NTRU Signature is used for digital signatures.



## Benefits of NTRU



NTRUEncrypt has several benefits over other public key cryptosystems, including:



- Resistance to attacks by quantum computers

- High performance

- Small key sizes

- Low bandwidth requirements

- Robustness against side-channel attacks



## Conclusion



This implementation provides a quantum-proof encryption scheme that can be used to secure sensitive data. The NTRU algorithm is believed to be resistant to attacks by quantum computers and has several benefits over other public key cryptosystems. The implementation is based on the NTRU Prime 4591 parameter set and provides a security level of approximately 128 bits.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/protdos/pq-ntru",
    "name": "pq-ntru",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,python3,post-quantum,ntru,quantum-proof,crypto,cryptography,lattice,svp,numpy,sympy",
    "author": "CodingLive | ProtDos",
    "author_email": "<rootcode@duck.com>",
    "download_url": "https://files.pythonhosted.org/packages/25/2d/ed156bdef92b2b08c3e6613f364c27f33f360dcc8a0cd20fda50cecb2b64/pq_ntru-0.1.3.tar.gz",
    "platform": null,
    "description": "\r\n# Quantum-Proof NTRU Algorithm in Python\r\n\r\n\r\n\r\n## General Overview\r\n\r\n\r\n\r\nThis is a Python implementation of the NTRUEncrypt algorithm, which is a lattice-based public key encryption scheme that is believed to be resistant to attacks by quantum computers. The implementation is based on the NTRU Prime 4591 parameter set, which provides a security level of approximately 128 bits. The purpose of this implementation is to provide a quantum-proof encryption scheme that can be used to secure sensitive data.\r\n\r\n\r\n\r\n## Requirements\r\n\r\n\r\n\r\nThe implementation requires the following Python packages:\r\n\r\n\r\n\r\n- NumPy\r\n\r\nTo install these packages, you can use the following command:\r\n\r\n```\r\n\r\npip install numpy sympy\r\n\r\n```\r\n\r\nYou can install it with the reuirements too:\r\n\r\n```\r\n\r\npip install -r requirements.txt\r\n\r\n```\r\n\r\n\r\n\r\n## PyPi Usage\r\n\r\nThis project can be installed with pip for easy usage.\r\n\r\n\r\n\r\n### Installation\r\n\r\n```pip install pq-ntru```\r\n\r\n\r\n\r\n### Usage\r\n\r\n```\r\n\r\nimport pq_ntru\r\n\r\n\r\n\r\npq_ntru.generate_keys(\"key_filename\", mode=\"moderate\")\r\n\r\nenc = pq_ntru.encrypt(\"key_filename\", \"message\")\r\n\r\ndec = pq_ntru.decrypt(\"key_filename\", enc)\r\n\r\n```\r\n\r\n\r\n\r\n## Other Usage\r\n\r\n\r\n\r\nTo use the implementation, you can import the ntru module and use the encrypt and decrypt functions to encrypt and decrypt messages, respectively.\r\n\r\n```\r\n\r\ngit clone https://github.com/protdos/pq-ntru\r\n\r\n```\r\n\r\n\r\n\r\n```\r\n\r\nimport NTRU2\r\n\r\n\r\n\r\nNTRU2.generate_keys(\"test\", mode=\"moderate\")\r\n\r\nenc = NTRU2.encrypt(\"test\", \"hello world\")\r\n\r\ndec = NTRU2.decrypt(\"test\", enc)\r\n\r\nprint(\"Decrypted message:\", dec)\r\n\r\n```\r\n\r\n\r\n\r\n## Implementation Details\r\n\r\n\r\n\r\nThe implementation is based on the NTRU Prime 4591 parameter set, which uses a polynomial ring with coefficients in the finite field Z/4591Z. The encryption and decryption algorithms use the NTRU lattice-based encryption scheme, which involves computing a polynomial that is close to a certain lattice point.\r\n\r\n\r\n\r\nThe implementation uses the following steps for encryption:\r\n\r\n\r\n\r\nConvert the message to a polynomial with coefficients in the range [-1, 1].\r\n\r\nGenerate a random polynomial with coefficients in the range [-1, 1] and compute its inverse modulo a certain polynomial.\r\n\r\nCompute the product of the message polynomial and the inverse polynomial modulo a certain polynomial, resulting in a new polynomial.\r\n\r\nAdd noise to the new polynomial to obtain the ciphertext polynomial.\r\n\r\nThe implementation uses the following steps for decryption:\r\n\r\n\r\n\r\nCompute the product of the ciphertext polynomial and the private key polynomial modulo a certain polynomial, resulting in a new polynomial.\r\n\r\nRecover the message polynomial by computing the inverse of the new polynomial modulo a certain polynomial.\r\n\r\n\r\n\r\n## Basic Info over NTRU\r\n\r\n\r\n\r\nNTRUEncrypt is a public key cryptosystem that is based on the mathematical problem of finding a short vector in a lattice. It is believed to be resistant to attacks by quantum computers due to its use of lattice-based cryptography. The security of the system is based on the difficulty of finding short vectors in the lattice, which is a problem that is believed to be hard even for quantum computers.\r\n\r\n\r\n\r\nNTRU was first proposed in 1996 by Hoffstein, Pipher, and Silverman. Since then, several variants of the algorithm have been proposed, including NTRUEncrypt and NTRU Signature. NTRUEncrypt is used for public key encryption, while NTRU Signature is used for digital signatures.\r\n\r\n\r\n\r\n## Benefits of NTRU\r\n\r\n\r\n\r\nNTRUEncrypt has several benefits over other public key cryptosystems, including:\r\n\r\n\r\n\r\n- Resistance to attacks by quantum computers\r\n\r\n- High performance\r\n\r\n- Small key sizes\r\n\r\n- Low bandwidth requirements\r\n\r\n- Robustness against side-channel attacks\r\n\r\n\r\n\r\n## Conclusion\r\n\r\n\r\n\r\nThis implementation provides a quantum-proof encryption scheme that can be used to secure sensitive data. The NTRU algorithm is believed to be resistant to attacks by quantum computers and has several benefits over other public key cryptosystems. The implementation is based on the NTRU Prime 4591 parameter set and provides a security level of approximately 128 bits.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A quantum proof (post-quantum) implementation of the NTRU algorithm",
    "version": "0.1.3",
    "split_keywords": [
        "python",
        "python3",
        "post-quantum",
        "ntru",
        "quantum-proof",
        "crypto",
        "cryptography",
        "lattice",
        "svp",
        "numpy",
        "sympy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8624b829ff7fe0845003b148e3bc644d39ecb2748bc5a2eae744b03bc60bc64a",
                "md5": "afef8fe1283d5505214d5269b7ab0e38",
                "sha256": "eb0cd810b8f767ce700b91d004e9ecd2159e88a023841f19bd4740d6c9325d9d"
            },
            "downloads": -1,
            "filename": "pq_ntru-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "afef8fe1283d5505214d5269b7ab0e38",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14155,
            "upload_time": "2023-03-25T12:16:37",
            "upload_time_iso_8601": "2023-03-25T12:16:37.622918Z",
            "url": "https://files.pythonhosted.org/packages/86/24/b829ff7fe0845003b148e3bc644d39ecb2748bc5a2eae744b03bc60bc64a/pq_ntru-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "252ded156bdef92b2b08c3e6613f364c27f33f360dcc8a0cd20fda50cecb2b64",
                "md5": "a44af1f796fd556e007439c56be83d3d",
                "sha256": "6dee1d9c3e1a8c014c5064ce2d471f4ee068a5b378c0fb8abf62bb46296be103"
            },
            "downloads": -1,
            "filename": "pq_ntru-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a44af1f796fd556e007439c56be83d3d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13462,
            "upload_time": "2023-03-25T12:16:39",
            "upload_time_iso_8601": "2023-03-25T12:16:39.107643Z",
            "url": "https://files.pythonhosted.org/packages/25/2d/ed156bdef92b2b08c3e6613f364c27f33f360dcc8a0cd20fda50cecb2b64/pq_ntru-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-25 12:16:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "protdos",
    "github_project": "pq-ntru",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pq-ntru"
}
        
Elapsed time: 0.05660s