Giter VIP home page Giter VIP logo

minicrypt's Introduction

minicrypt

------------

Cryptographic hashes: blake3, blake2s, sha512, md6.

Base encodings: base91, base32

Ascii table dumper: ascii

------------

Statically linked binaries, linux 64bit, sizes: between 1kB and 5kB: ./bin
Part of "minicore" - Aiming for a unix system with 64kB.

sha1 is the reference implementation, I just replaced the loop unrolls with loops, and a few other size optimizations. Got this down from 8kB to 1kB.

Since the whole bin directory is less than 32kB, I made a tarball, containing this readme, the binaries, and accompanying licenses. minicrypt.tgz.

The executables just read from stdin, and write to stdout.

Possible arguments are printed with "-h" (if any).

The hashes are based on the reference implementations, slightly modified to optimize for size. (stripped loop unrolls, etc)

Replaced several 32bit instruction with 64bit, and inserted bswap/ror/rol instructions, where possible.

amd64 only. (Intel and AMD x64)

The full sources, which do not depend on any library, also not libc, are in the folders, and named blake3sum.src.c, ...

These are generated with minimake, part of minilib. (Another project of mine)

The sources here are quite untidy. My fault. On the other hand, the disassembly of the binaries should be readable. If you're in doubt, I stripped them heavily to save space, even the section headers are stripped. Therefore you'd need something like ndisasm to get the disassembly. The entry function is somewhere around 0xc2 (pop rdi).

I hand the cleanup of the sources to the compiler, with best wishes.

------------

The following licenses apply to the unmodified implementations.

  • md6: MIT
  • blake3: CC0, or alternatively Apache License 2.0
  • blake2: CC0, Apache 2.0, or Openssl
  • sha512: BSD 2-clause
  • base91: BSD 3-clause
  • sha1: Steve Reid, Public Domain

base32, ascii, hex entered by me. BSD 3clause. (sources and binaries)
minilib comes with other License terms. (BSD like, with attribution), but I don't apply those terms to the binaries or sources here.

------------

References:

------------

somehow - I guess, I'm going to enlarge the 64kB core to 128 kB. Or I'll need to have a multicall binary. I don't like that, I don't like bloating software either, I'm screwed

Maybe, I just shouldn't count "nonstandard" tools - md6, blake3!?

misc, December 2022.
https://github.com/michael105


Currently, I'm thinking about an abstract interface.
Did some experiments with oop in c. It is a so really good idea.
Like the size optimization of hashes.


The openbsd fish did some diet.


       o                 o
                  o
         o   ______      o
           _/  (   \_
 _       _/  (       \_  O
| \_   _/  (   (    0  \
|== \_/  (   (          |
|=== _ (   (   (        |
|==_/ \_ (   (          |
|_/     \_ (   (    \__/
          \_ (      _/
            |  |___/
           /__/



(Artwork by tucker)


BSD 3-Clause License

Copyright (c) 2022, Michael (misc) Myer (https://github.com/michael105)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

minicrypt's People

Contributors

michael105 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.