Giter Site home page Giter Site logo

abumq / mine Goto Github PK

View Code? Open in Web Editor NEW
89.0 9.0 23.0 474 KB

Minimal and single-header cryptography library (AES, RSA, Base16, Base64, ZLib), implemented for education purposes - use @abumq/ripe for production.

License: Other

CMake 4.59% PHP 1.10% C++ 87.78% CSS 6.53%
rsa aes-cbc cryptography base64 base16 zlib aes-128 aes-256 aes-192 aes-ecb

mine's Introduction

Note

โ˜๏ธ This is not a true representation of most used languages, as I have over 30 private repositories in my personal Github account and over 50 private repositories spread across 3 personally owned organizations. These repositories use mixture of C++, BASH, SQL, Javascript (for Vanilla JS, React and Node.js) and Python (for ML/AI, Jupyter notebooks, APIs and scripts)

Sponsorship

If my work benefits you or your organization in any way, or you want to support me by resuming work on my dream project, please consider supporting me via Github sponsorship program.

mine's People

Contributors

abumq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mine's Issues

AES encryption discrepancy

AES encryption is broken in some cases

Parameters

INPUT:

{"status":0,"ack":1,"flags":2001,"max_bulk_size":50,"server_info":{"version":"2.1.1-dev-debug"},"key":"141E4B143B314C71203E43481F1566504B3F52665847141F02104335650C5315","client_id":"muflihun00102030","logging_port":8778,"age":240,"date_created":1520477743}

KEY: 141E4B143B314C71203E43481F1566504B3F52665847141F02104335650C5315
IV: 3E552F2851473510663466583C084D29

Reproduce

## mine
echo '{"status":0,"ack":1,"flags":2001,"max_bulk_size":50,"server_info":{"version":"2.1.1-dev-debug"},"key":"141E4B143B314C71203E43481F1566504B3F52665847141F02104335650C5315","client_id":"muflihun00102030","logging_port":8778,"age":240,"date_created":1520477743}' | mine -e --aes --key 141E4B143B314C71203E43481F1566504B3F52665847141F02104335650C5315 --iv 3E552F2851473510663466583C084D29 --base64

## ripe
echo '{"status":0,"ack":1,"flags":2001,"max_bulk_size":50,"server_info":{"version":"2.1.1-dev-debug"},"key":"141E4B143B314C71203E43481F1566504B3F52665847141F02104335650C5315","client_id":"muflihun00102030","logging_port":8778,"age":240,"date_created":1520477743}' | ripe -e --aes --key 141E4B143B314C71203E43481F1566504B3F52665847141F02104335650C5315 --iv 3E552F2851473510663466583C084D29 --base64

Output

xhlE7aSsuVtzKBSNQU8eI0A81/HQ2O60YxYRXNjERTNCymJLkAbBYPlfO/wJKWfxbSPFMt0bt0mhyKoHzDsnOOdNkY1iUX99D17LM4pSzpC5iRsxoHPyx6Bp5huZtJ9dZRLom22017fFlmuW8LGVhWt5NsfR/2bwcZOICRnKMXEg06YVsvSOBMKhBtoqpzw+IWgzJxN7GZzZifsIGWvb9OMLiTufG+dMl+92mdf3EG1t7z+SWErcAX4PaNNYSl8cZDg13d2hyoeW2NGis2ga/XL+c2qIWBNbTkZqJFtThrT/Fz20FLnhJjVbmMhCcXo/lsEcF74OWtkfAvxyKGoHuQ==

or

C61944EDA4ACB95B7328148D414F1E23403CD7F1D0D8EEB46316115CD8C4453342CA624B9006C160F95F3BFC092967F16D23C532DD1BB749A1C8AA07CC3B2738E74D918D62517F7D0F5ECB338A52CE90B9891B31A073F2C7A069E61B99B49F5D6512E89B6DB4D7B7C5966B96F0B195856B7936C7D1FF66F07193880919CA317120D3A615B2F48E04C2A106DA2AA73C3E21683327137B199CD989FB08196BDBF4E30B893B9F1BE74C97EF7699D7F7106D6DEF3F92584ADC017E0F68D3584A5F1C643835DDDDA1CA8796D8D1A2B3681AFD72FE736A8858135B4E466A245B5386B4FF173DB414B9E126355B98C842717A3F96C11C17BE0E5AD91F02FC72286A07B9

Expected Output

xhlE7aSsuVtzKBSNQU8eI0A81/HQ2O60YxYRXNjERTNCymJLkAbBYPlfO/wJKWfxbSPFMt0bt0mhyKoHzDsnOOdNkY1iUX99D17LM4pSzpC5iRsxoHPyx6Bp5huZtJ9dZRLom22017fFlmuW8LGVhWt5NsfR/2bwcZOICRnKMXEg06YVsvSOBMKhBtoqpzw+IWgzJxN7GZzZifsIGWvb9OMLiTufG+dMl+92mdf3EG1t7z+SWErcAX4PaNNYSl8cZDg13d2hyoeW2NGis2ga/XL+c2qIWBNbTkZqJFtThrT/Fz20FLnhJjVbmMhCcXo/lsEcF74OWtkfAvxyKGoHuTFFrw5fRgqIGkLqgTEgmBU=

or

C61944EDA4ACB95B7328148D414F1E23403CD7F1D0D8EEB46316115CD8C4453342CA624B9006C160F95F3BFC092967F16D23C532DD1BB749A1C8AA07CC3B2738E74D918D62517F7D0F5ECB338A52CE90B9891B31A073F2C7A069E61B99B49F5D6512E89B6DB4D7B7C5966B96F0B195856B7936C7D1FF66F07193880919CA317120D3A615B2F48E04C2A106DA2AA73C3E21683327137B199CD989FB08196BDBF4E30B893B9F1BE74C97EF7699D7F7106D6DEF3F92584ADC017E0F68D3584A5F1C643835DDDDA1CA8796D8D1A2B3681AFD72FE736A8858135B4E466A245B5386B4FF173DB414B9E126355B98C842717A3F96C11C17BE0E5AD91F02FC72286A07B93145AF0E5F460A881A42EA8131209815

Difference is last few bits TFFrw5fRgqIGkLqgTEgmBU=

base64 not work well on vc2019

Expression: cannot seek string iterator after end

The program is normal under the clang compiler, but on vc2019, Microsoft will report an error on the judgment condition of your "for" statement. If the judgment of the maximum pointer of the iterator exceeds the error, the debug channel will report an error, and the output of the Release channel will be abnormal.
Assuming the string length is "length", then it is normal when you execute begin+length<end, but after each round of the loop, the pointer is shifted back by 3 bits, then begin+length+1<end and begin+length+2<end two judgment statements will report an error.

I have a solution:
Change
for (auto it = begin; it < end; it += 3) {
to

auto length = end - begin;
for (auto i = 0; i < length; i += 3) {
				auto it = begin + i;

Change

if (it + 1 < end) {
if (it + 2 < end) {

to

if (i + 1 < length) {
if (i + 2 < length) {

Personally think this is the easiest solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.