Giter VIP home page Giter VIP logo

keygen's Introduction

KeyGen

CI GitHub release License C

KeyGen is a generator for keys and passwords. It's usable as standalone application and library.

The cryptography behind is provided by OpenSSL.

Requirements

Building

Building the library and application:

mkdir build
cd build
cmake ..
make

Testing

After building, the tests are executed within the build directory using:

ctest

or running make with one of these targets:

make < target >
test Runs ctest (same as ctest)
unittest Builds and runs all test
coverage Coverage (requires gcovr)

Usage

The unit of length are (ascii-) characters (1 char = 1 byte). So a length of 20 means 20 (ascii-) char's = 20 Byte.

Application

The application is used with commandline arguments. Run keygen -h to print the help.

Arguments:

 Usage: keygen [Options]

  --ascii   -a :  Generates a key of ASCII characters, ranging from '!' to'~' (default)
  --ascii-blank -w :  Generates a key of ASCII characters, ranging from ' ' to'~';
                      same as --ascii, but includes blanks
  --ascii-reduced   -r :  Generates a key of reduced ASCII
  --alphanum    -p :  Generates a key of alphanumeric characters
  --length <n>  -l <n> :  Generates a key of <n> bytes length
  --short   -s :  Shows only the key
  --help    -h :  Shows the help
  --version -v :  Shows version informations and license.

Note: For generating, the --length / -l parameter is always necessary.

Examples

Key of 24 length:

$ keygen -l 20

  Generated key:
----------
amZ5QiX>9Z-=4U.XP;bD
----------
  Length : 20 / 20

this is equal to keygen --ascii -l 20 and keygen -a -l 20.

The same key size, but with short (key only) output:

$ keygen -s -l 20
ZI^fD{dX<qa?uw?%'acM

Key of 4048 length, stored in a file:

$ keygen --short --length 4048 > example.key

(Use --short / -s to write key only)

Library

const int KEY_LENGTH = 100000; // Key length
uint8_t* buffer = malloc(KEY_LENGTH * sizeof(uint8_t)); // allocate buffer

if( buffer == NULL )
{
    // Error - malloc() failed
}
else
{
    KeyGenError err = keygen_createKey(buffer, KEY_LENGTH, ASCII);

    if( err == KG_ERR_SUCCESS )
    {
        // Key generated, do something
    }
    else
    {
        // Error - handle that case
    }

    // Finally clean and free the buffer
    keygen_cleanAndFreeBuffer(buffer, length);
}

Notes

  • The keylength is set to a minimum of 8 - lesser length is not allowed
  • Using parameter -s / --short will reduce the output to key only

Documentation

License

GNU General Public License (GPL)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

keygen's People

Contributors

iniesta8 avatar mackiovello avatar offa avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

keygen's Issues

Handle key sizes greater int max

OpenSSL's RAND_bytes() supports only key sizes of size int. Since longer keys are possible, this needs some special handling.

Migrate to gcovr

Lcov has become a hassle more and more. Gcovr on the other hand is easy to setup and use.

GCC 10 support

GCC 10 is already available on some distributions โ€“ though not officially released.

Provide gcvor config file

Instead of passing all arguments and configurations via cmake, it's more maintainable to move everything into a config file.

Ref. #46

Clang 7 fails with linker error

Clang 7 (#31) fails with linker error:

/usr/bin/ld: ArgumentTest: hidden symbol `_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE11__recommendEm' isn't defined
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Update Flawfinder

The version of flawfinder shipped by ubuntu is seriously old, the CI build should run with the latest version.

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.