» encrypt a string to obtain a fixed length
encrypt a string to obtain a fixed length
|May 7, 2014
Posted by forumadmin
let’s suppose I have the following possible values of a string:
actually, this is a GET parameter obtained from the URL.
exp can become very large so I want to make it shorter(encrypt it). Not because of security reasons, but because I don’t want it to be long and ugly.
So I want to encrypt
exp to become a short string with a fixed length of let’s say 15. Is it possible somehow? Something like this:
encrypt("110") results in "Ax1234B"
encrypt("110-120") results in "85xHdjX"
I am using python btw
forgot to mention: I also need a
decrypt function to be available. Moreover, I would prefer solutions from the standard python library without having to install new packages.
More Related Questions
- Given a URL, how to encode a files contents as base64 with Python / Django? I am building a Django-based website, and am having trouble figuring out a decent way to email some larger PDFs and such to my users.
The files in question never touch our servers; […]
- Django – File Upload: Open the file as text instead of bytes On Python 3.3 and Django 1.6
Is it possible, in a ModelForm's View, to open an uploaded file as a text file instead of bytes ?
Here's some example code :
def post(self, request, *args, […]
- How to use Django to get the name for the host server? How to use Django to get the name for the host server?
I need the name of the hosting server instead of the client name? Asked By - […]
- Django – use reverse url mapping in settings A few of the options in the django settings file are urls, for example LOGIN_URL and LOGIN_REDIRECT_URL. Is it possible to avoid hardcoding these urls, and instead use reverse url […]
- Django-cms Apphook url doesnt load I have a django-cms project that contains an app called core. Inside core I created a file "cms_app.py" as follows:
# -*- coding: utf8 -*-
from cms.app_base import CMSApp
- Why do real-world servers prefer gzip over deflate encoding? We already know deflate encoding is a winner over gzip with respect to speed of encoding, decoding and compression size.
So why do no large sites (that I can find) send it (when I use a […]
- Unexpected output with zlib_encode() I'm trying to encode a chunk of binary data with PHP in the same way zlib's compress2() function does it. However, using zlib_encode(), I get the wrong encoded output. I know this because […]
- effective solution: base32 encoding in php I am looking for a base32 function/class for php. the different classes and function that i found are all very ineffective. I ran a benchmark and came to the following result:
- Python script for minifying CSS? I'm looking for a simple Python script that can minify CSS as part of a web-site deployment process. (Python is the only scripting language supported on the server and full-blown parsers […]