Metadata-Version: 1.1
Name: gocept.pseudonymize
Version: 0.4
Summary: Pseudonymize data like text, email addresses or license tags.
Home-page: https://bitbucket.org/gocept/gocept.pseudonymize/
Author: gocept <mail@gocept.com>
Author-email: mail@gocept.com
License: ZPL 2.1
Description: .. contents::
        
        ===================
        gocept.pseudonymize
        ===================
        
        This package provides helper functions to pseudonymize data like text,
        integers, email addresses or license tags.
        
        It uses the ``crypt.crypt()`` function for pseudonymization, which means,
        longer text blocks require multiple ``crypt.crypt()`` calls.
        
        
        Usage
        =====
        
        ``gocept.pseudonymize`` provides single functions for pseudonymization of
        various data types. Each function takes the ``value``, which should be
        pseudonymized, and a ``secret``, which is passed as a ``salt`` to the
        ``crypt`` module.  If ``secret`` and ``value`` do not change the
        pseudonymize function returns the exact same result when called again::
        
            >>> import gocept.pseudonymize
            >>> gocept.pseudonymize.text('asdf', 'secret')
            'dugD'
            >>> gocept.pseudonymize.text('asdf', 'secret')
            'dugD'
        
        The result has always the same string lenth as the input. But there is no
        guaranty that it is still valid in the domain of the input value. For
        example the checksum of the pseudonymized IBAN is not correct.
        
        
        This package is tested to be compatible with Python version 2.7 and 3.3.
        
        
        Detailed usage examples
        =======================
        
        There are different pseudonymization function because it is not always
        possible to guess the correct one by looking at the input data.
        
        * For an integer value use the ``integer`` function::
        
            >>> gocept.pseudonymize.integer(4711, 'secret')
            2111
        
        * For a decimal value use the ``decimal`` function::
        
            >>> from decimal import Decimal
            >>> gocept.pseudonymize.decimal(Decimal('-123.45'), 'secret')
            Decimal('-8772.11')
        
        * For an email address use the ``email`` function::
        
            >>> gocept.pseudonymize.email('mail@gocept.com', 'secret')
            'w6ba@nG7NGno.de'
        
        * For an IBAN account number use the ``iban`` function::
        
            >>> gocept.pseudonymize.iban('US00123456787650047623', 'secret')
            'DE10312010975100119998'
        
        * For a license tag of a car use  the ``license_tag`` function::
        
            >>> gocept.pseudonymize.license_tag('HAL-AB 123', 'secret')
            'PUD-AM 117'
        
        * For a phone number use the ``phone`` function::
        
            >>> gocept.pseudonymize.phone('+49 172 34123142', 'secret')
            '0104118118111676'
        
        * For a date use the ``date`` function::
        
            >>> from datetime import date
            >>> gocept.pseudonymize.date(date(1983, 1, 11), 'secret')
            datetime.date(3021, 1, 18)
        
        * For a date represented as string use the ``datestring`` function. It takes
          a format string and keeps zeros date parts as zero.::
        
            >>> gocept.pseudonymize.datestring('00/03/2003', 'secret', format='DD/MM/YYYY')
            '00/10/7399'
        
        * For a time value use the ``time`` function::
        
            >>> from datetime import time
            >>> gocept.pseudonymize.time(time(23, 59, 59), 'secret')
            datetime.time(13, 11, 49)
        
        There are some additional pseudonymizer functions and helper functions in
        this package.
        
        =============
        Running tests
        =============
        
        The tests are run using tox_. See its documentation for details.
        
        .. _tox : https://pypi.python.org/pypi/tox
        
        ==============================
        Developing gocept.pseudonymize
        ==============================
        
        :Author:
            `gocept <http://gocept.com/>`_ <mail@gocept.com>
        
        :Online documentation:
            http://pythonhosted.org/gocept.pseudonymize/
        
        :PyPI page:
            http://pypi.python.org/pypi/gocept.pseudonymize/
        
        :Issues:
            `report by e-mail <mail@gocept.com>`_
        
        :Source code:
            https://bitbucket.org/gocept/gocept.pseudonymize/
        
        :Current change log:
            https://bitbucket.org/gocept/gocept.pseudonymize/raw-file/tip/CHANGES.txt
        
        
        ==========
        Change log
        ==========
        
        0.4 (2014-01-14)
        ================
        
        - Bugfix: ``.text`` pseudonymizer now works as expected for texts longer
          than 11 bytes. Previously it returned an 11 byte result for longer texts
          ignoring the part after the 11th byte (default behavior of the used
          ``crypt`` implementation). (#1296)
        
        - Fixed handling of `Extended crypt` (signalled by starting the salt with an
          underscore): Salt is now correctly stripped from result. **Caution:** This
          leads to different pseudonymization results when using a secret starting
          with underscore than in version 0.3.
        
        
        0.3 (2013-10-09)
        ================
        
        - Fix tests in documentation + testing documentation now.
        
        - Add new pseudonymizers:
        
          - ``.datestring``
        
          - ``.day``
        
          - ``.month``
        
          - ``.year``
        
        - **Caution:** Due to changed implementation of the ``.date`` function it
          returns different values than in version 0.2.
        
        
        0.2 (2013-09-06)
        ================
        
        - ``.date`` does not return pseudonymized years smaller than `1900` anymore as
          ``datetime.date`` can not handle years smaller that `1900`.
        
        
        0.1 (2013-09-05)
        ================
        
        - Initial release.
        
Keywords: Pseudonymization
Platform: UNKNOWN
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
