Git Product home page Git Product logo

python-sha1's People

Contributors

ajalt avatar cfahlgren1 avatar evansneath avatar jessaustin 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-sha1's Issues

Is the future import needed for anything?

Hey,

a quick question... is the line

 from __future__ import print_function, unicode_literals

really needed for anything? It works without it for me and it doesn't confuse me with python3 unicode literals in python2 code

Incorrect hash on stdin input with \r\n line endings for Python < 3.1

Issue

If a file with \r\n line endings is read through stdin, Python will strip the \r bytes, leading to an incorrect hash. The file.detch() function allows us to read the data correctly as binary, but this funciton is new in Python 3.1.

Example

$ unix2dos test.py
unix2dos: converting file test.py to DOS format ...

$ python sha1.py test.py
sha1-digest: 9e3a331958bc44d6c0c94ede204a89069f26e582

$ python sha1.py < test.py
sha1-digest: 13ebe55e971dd92b723795c8f2b1ae31ef32cb28

$ sha1sum test.py
9e3a331958bc44d6c0c94ede204a89069f26e582 *test.py

Workaround

Setting the PYTHONBUFFERED variable, or calling python with the -u flag will open stdin in binary mode.

$ PYTHONBUFFERED=x python sha1.py test.py
sha1-digest: 9e3a331958bc44d6c0c94ede204a89069f26e582

$ python -u sha1.py test.py
sha1-digest: 9e3a331958bc44d6c0c94ede204a89069f26e582

Getting hash of 1GB file under windows throws an error

>sha1.py kali-2.0.1-rpi.img.xz
Traceback (most recent call last):
  File "D:\python-sha1\sha1.py", line 121, in <module>
    data = f.read()
MemoryError

I don't know what is problem but it has place to be. The size of kali-2.0.1-rpi.img.xz is 1038MB.

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.