FPlusRSA


NameFPlusRSA JSON
Version 1.0.0 PyPI version JSON
download
home_page
Summarya small library, you can use it to implement RSA encryption and decryption and other basic methods
upload_time2024-02-03 13:06:27
maintainer
docs_urlNone
authorFPlusStudio
requires_python
license
keywords python rsa encryption algorithm windows mac linux
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FPlusRSA

### Made by [FPlus Studio](https://ql27731117.icoc.ws)
## **Introduction**
This is a simple library,you can use it to implement encryption and decryption functions based on RSA encryption algorithm.
It contains six functions that require the introduction of the ```secrets``` library and the ```math``` library.

## **Usages of functions**
#### 1.```RSA_encrypt```
It has two parameters ```data:str``` and ```pubic_key:tuple```,the ```pubic_key:tuple``` has two ```int``` items,they are geted by function ```get_pubic_key```.In the end,it will return a encrypted list.
*The ```pubic_key[1]``` is must greater than every coding number of data's character,or the encrypted data will be wrong.*
#### 2.```RSA_decode```
It has two parameters ```data:list``` and ```private_key:tuple```,the ```private_key:tuple``` has two ```int``` items,they are geted by function ```get_private_key```.The ```data:list``` is the encrypted list from ```RSA_encrypt```.In the end,it will return a decoded string.
#### 3.```is_prime```
It is a internal functions,has one parameter ```n:int```.Ine the end,it will return a ```bool```.
#### 4.```get_pubic_key```
It has two parameters ```p:int``` and ```q:int```,they are must prime numbers.You can get them by function ```get_random_prime```.And in the end,it will return a tuple(the pubic key).
#### 5.```get_private_key```
It has three parameters ```pubic_key:tuple```,```p:int``` and ```q:int```,the ```p:int``` and ```q:int``` is the same as ```p:int``` and ```q:int``` of ```get_pubic_key```,the ```pubic_key:tuple``` is from ```get_pubic_key```,too.In the end,it will return a tuple(the private key).
#### 6.```get_random_prime```
It has one parameter ```bits:int```,the ```bits:int``` is must a even number and greater than 1.In the end,it will return a random prime number of ```bits:int``` bits.

## **A simple example**
```python
from FPlusRSA import *

#if you want to encrypt most languages normally,the parameter of get_random_prime() better be greater than 8
p = get_random_prime(10)
q = get_random_prime(10)

a = get_pubic_key(p, q)
b = get_private_key(a, p, q)

string = "hello world"
e = RSA_encrypt(string, a)
print(e)#encrypted data
d = RSA_decode(e, b)
print(d)#decoded data
```

## **Versions**
### `1.0.0` 
##### 1.Basic function implementation.
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "FPlusRSA",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,RSA,encryption algorithm,windows,mac,linux",
    "author": "FPlusStudio",
    "author_email": "qweasdghjkx@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/3f/1b/9fb4c367515fe5b378cd2e443c5ef01c5509c2ac6c8bb8a29f6510ad3df4/FPlusRSA-1.0.0.tar.gz",
    "platform": null,
    "description": "# FPlusRSA\n\n### Made by [FPlus Studio](https://ql27731117.icoc.ws)\n## **Introduction**\nThis is a simple library,you can use it to implement encryption and decryption functions based on RSA encryption algorithm.\nIt contains six functions that require the introduction of the ```secrets``` library and the ```math``` library.\n\n## **Usages of functions**\n#### 1.```RSA_encrypt```\nIt has two parameters ```data:str``` and ```pubic_key:tuple```,the ```pubic_key:tuple``` has two ```int``` items,they are geted by function ```get_pubic_key```.In the end,it will return a encrypted list.\n*The ```pubic_key[1]``` is must greater than every coding number of data's character,or the encrypted data will be wrong.*\n#### 2.```RSA_decode```\nIt has two parameters ```data:list``` and ```private_key:tuple```,the ```private_key:tuple``` has two ```int``` items,they are geted by function ```get_private_key```.The ```data:list``` is the encrypted list from ```RSA_encrypt```.In the end,it will return a decoded string.\n#### 3.```is_prime```\nIt is a internal functions,has one parameter ```n:int```.Ine the end,it will return a ```bool```.\n#### 4.```get_pubic_key```\nIt has two parameters ```p:int``` and ```q:int```,they are must prime numbers.You can get them by function ```get_random_prime```.And in the end,it will return a tuple(the pubic key).\n#### 5.```get_private_key```\nIt has three parameters ```pubic_key:tuple```,```p:int``` and ```q:int```,the ```p:int``` and ```q:int``` is the same as ```p:int``` and ```q:int``` of ```get_pubic_key```,the ```pubic_key:tuple``` is from ```get_pubic_key```,too.In the end,it will return a tuple(the private key).\n#### 6.```get_random_prime```\nIt has one parameter ```bits:int```,the ```bits:int``` is must a even number and greater than 1.In the end,it will return a random prime number of ```bits:int``` bits.\n\n## **A simple example**\n```python\nfrom FPlusRSA import *\n\n#if you want to encrypt most languages normally,the parameter of get_random_prime() better be greater than 8\np = get_random_prime(10)\nq = get_random_prime(10)\n\na = get_pubic_key(p, q)\nb = get_private_key(a, p, q)\n\nstring = \"hello world\"\ne = RSA_encrypt(string, a)\nprint(e)#encrypted data\nd = RSA_decode(e, b)\nprint(d)#decoded data\n```\n\n## **Versions**\n### `1.0.0` \n##### 1.Basic function implementation.",
    "bugtrack_url": null,
    "license": "",
    "summary": "a small library, you can use it to implement RSA encryption and decryption and other basic methods",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        "rsa",
        "encryption algorithm",
        "windows",
        "mac",
        "linux"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f1b9fb4c367515fe5b378cd2e443c5ef01c5509c2ac6c8bb8a29f6510ad3df4",
                "md5": "e00048bf08abbd7cb612b62ebca3e8e3",
                "sha256": "859c1e701db56ad8c7d1f475fd42b04f96ba72ce2a459938e16efcf60d7ad0d0"
            },
            "downloads": -1,
            "filename": "FPlusRSA-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e00048bf08abbd7cb612b62ebca3e8e3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2856,
            "upload_time": "2024-02-03T13:06:27",
            "upload_time_iso_8601": "2024-02-03T13:06:27.921143Z",
            "url": "https://files.pythonhosted.org/packages/3f/1b/9fb4c367515fe5b378cd2e443c5ef01c5509c2ac6c8bb8a29f6510ad3df4/FPlusRSA-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-03 13:06:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "fplusrsa"
}
        
Elapsed time: 0.17925s