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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xor_string-0.2.3.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file xor_string-0.2.3.tar.gz.

File metadata

  • Download URL: xor_string-0.2.3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for xor_string-0.2.3.tar.gz
Algorithm Hash digest
SHA256 07e579f265411c1b3845ca43c999fdf6c9763f591967e79761743e2f16b601a2
MD5 8726b3cdb65d062288e7c8707b452947
BLAKE2b-256 696add961117f0bcf1299c1c898229308f3c135c231a3662a6ab1768e5f59c05

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 file

0.2.2

1 file

0.2.1

0.2.0

1 file

0.1.7

1 file

0.1.6

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page