Giter Site home page Giter Site logo

oohlaf / python-whirlpool Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 4.0 98 KB

Python wrapper extension for C Whirlpool digest reference implementation.

Home Page: https://pypi.python.org/pypi/Whirlpool

License: The Unlicense

C 85.52% Python 13.43% Batchfile 1.06%
whirlpool python digest hashlib unlicense wrapper python-whirlpool whirlpool-reference c-extension

python-whirlpool's Introduction

python-whirlpool

Travis CI Build Status AppVeyor Build Status License: Unlicense

The Whirlpool algorithm is designed by Vincent Rijmen and Paulo S.L.M. Barreto. It is a secure and modern digest function that has been recommended by the NESSIE project and adopted in the ISO/IEC 10118-3 international standard.

Digest functions, also known as hash functions, produce fixed-length output (a digest or hash) from a variable-length message. They are designed to be a one-way function.

This library is a Python wrapper around the Whirlpool C reference implementation. The Whirlpool reference implementations are public domain, as is this code.

The first version of the wrapper was written by James Cleveland with help from #python on irc.freenode.net.

Later on, the wrapper was rewritten by Olaf Conradi to use the hashlib interface and he made the library compatible with Python 3.

Installation

This library is available on PyPI.

pip install whirlpool

Usage

This is the same interface provided by the other digest algorithms in Python's hashlib.

import whirlpool

wp = whirlpool.new("My String")
hashed_string = wp.hexdigest()

wp.update("My Salt")
hashed_string = wp.hexdigest()

Starting with Python 3 text strings (as shown above) are stored as unicode. You need to specify the encoding of these strings before hashing.

wp = whirlpool.new(data.encoding('utf-8'))

Strings that are marked as binary do not need encoding.

Development

The source code is available on GitHub.

git clone https://github.com/oohlaf/python-whirlpool.git
cd python-whirlpool

Install in development mode using:

python setup.py develop

Or install in editable mode using pip:

pip install -e .

Testing

This module is tested using Python 2.7, PyPy, and Python 3.3 and up.

You can run the test suite using:

python setup.py test

python-whirlpool's People

Contributors

oohlaf avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

python-whirlpool's Issues

32-bit module - build from source?

Hello!

I am working on a project that requires whirlpool to compare hashes from a different system. Although I am strictly limited by the environment I run in, which is 32-bit python 3.8.6.

I tried building from source with; CFLAGS=-m32 LDFLAGS=-m32 python3.8 setup.py install - although I had no luck, as it seem there's not expectations to build this with 32-bit.

Could I get some advice how to go forward to achieve this?

can't install whirlpool in python.

pywhirlpool.c
whirlpool/pywhirlpool.c(411): error C2106: '=': left operand must be l-value
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\HostX86\x86\cl.exe' failed with exit code 2
[end of output]

What exactly is this error and how do I resolve this

undefined symbol: PyString_FromStringAndSize

Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import whirlpool
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /usr/local/lib/python3.5/dist-packages/whirlpool.cpython-35m-arm-linux-gnueabihf.so: undefined symbol: PyString_FromStringAndSize

Whirlpool has been instaled with pip3.

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.