Skip to Main Content
Hands-On Cryptography with Python
book

Hands-On Cryptography with Python

by Samuel Bowne
June 2018
Beginner to intermediate content levelBeginner to intermediate
100 pages
2h 9m
English
Packt Publishing
Content preview from Hands-On Cryptography with Python

Large integers in Python

Python can do multiplication and division–and a contented multiplication and division of arbitrarily large integers with complete precision:

If we have 1001 and then we calculate 1001 squared, we get the right answer, of course; and even if we take a number like 10**100 + 1, it correctly gets that number a hundred places with a 1 at each end. Now, if we square that number, it again gets it correct, all the way to the one at each end.

So, for simple integer operations, Python's precision is unlimited. However, if we want to square root, we need to import a math library:

The math library does not keep any arbitrary ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Cryptography in Python: Learning Correct Cryptography by Example

Practical Cryptography in Python: Learning Correct Cryptography by Example

Seth James Nielson, Christopher K. Monson
Cryptography Algorithms

Cryptography Algorithms

Massimo Bertaccini

Publisher Resources

ISBN: 9781789534443Supplemental Content