Skip to main content
# xor_string

![PyPI downloads](https://img.shields.io/pypi/dm/xor_string.svg) ![PyPI version](https://img.shields.io/pypi/v/xor_string.svg) ![PyPI python version](https://img.shields.io/pypi/pyversions/xor_string.svg)

Python doesn't support (natively) XOR on everything else than int, and this is annoying.

```
>>> 'hello' ^ 'world'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for ^: 'str' and 'str'
```

Fortunately, Python has the (amazing) itertools module.

## unit tests
* `nosetests -v`

## Explanations

For those who are not familiar with python:

* cycle(key) returns an iterator that produces an infinite concatenation of key's content
* izip(a, b) returns an iterator that aggregates elements from each of the iterables. It stops on the shortest input sequence (here, our message, since cycle(key) is infinite
* ord(a) and chr(57) return (respectively) the integer representing the given char and the char represented by the given integer.
* ''.join() (roughly) concatenate every items of the list passed in argument in a string

Metadata

Release files for xor_string 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xor_string 0.2.3
File Size Uploaded Provenance Actions
xor_string-0.2.3.tar.gz 3.0 kB Without provenance Details for xor_string-0.2.3.tar.gz

Release files / xor_string-0.2.3.tar.gz

Download URL xor_string-0.2.3.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
07e579f265411c1b3845ca43c999fdf6c9763f591967e79761743e2f16b601a2
BLAKE2b-256 checksum
How to use checksums
696add961117f0bcf1299c1c898229308f3c135c231a3662a6ab1768e5f59c05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for xor_string 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page