1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [pycrypto] Public Key encryption of files
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Public%20Key%20encryption%20of%20files&In-Reply-To=8129C8D99AA86D4A9A8BEA3E7DCC806A36B9BBF066%40exch-mail.bridge.net">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="000502.html">
<LINK REL="Next" HREF="000504.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[pycrypto] Public Key encryption of files</H1>
<B>Dave Pawson</B>
<A HREF="mailto:pycrypto%40lists.dlitz.net?Subject=%5Bpycrypto%5D%20Public%20Key%20encryption%20of%20files&In-Reply-To=8129C8D99AA86D4A9A8BEA3E7DCC806A36B9BBF066%40exch-mail.bridge.net"
TITLE="[pycrypto] Public Key encryption of files">dave.pawson at gmail.com
</A><BR>
<I>Thu Nov 10 12:26:52 CST 2011</I>
<P><UL>
<LI>Previous message: <A HREF="000502.html">[pycrypto] Public Key encryption of files
</A></li>
<LI>Next message: <A HREF="000504.html">[pycrypto] Public Key encryption of files
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#503">[ date ]</a>
<a href="thread.html#503">[ thread ]</a>
<a href="subject.html#503">[ subject ]</a>
<a href="author.html#503">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On 10 November 2011 18:18, Dean Macinskas <<A HREF="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">dmacinskas at geobridge.net</A>> wrote:
><i> All blocks need to be 16 bytes.  So for example, if the file is 2,000,005
</I>><i> bytes, you'd encrypt 125,000 16-byte blocks; you then have 5 bytes left
</I>><i> over, to which you'd add 11 padding bytes, which can be any binary value and
</I>><i> then encrypt that last block.
</I>
def _lazysecret(secret, blocksize=32, padding='}'):
"""pads secret if not legal AES block size (16, 24, 32)"""
if not len(secret) in (16, 24, 32):
return secret + (blocksize - len(secret)) * padding
return secret
Python makes it quite easy.
The reason I started to use it!
Thanks to
src <A HREF="http://www.turnkeylinux.org/blog/python-symmetric-encryption">http://www.turnkeylinux.org/blog/python-symmetric-encryption</A>
great piece of software.
regards
--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
<A HREF="http://www.dpawson.co.uk">http://www.dpawson.co.uk</A>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000502.html">[pycrypto] Public Key encryption of files
</A></li>
<LI>Next message: <A HREF="000504.html">[pycrypto] Public Key encryption of files
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#503">[ date ]</a>
<a href="thread.html#503">[ thread ]</a>
<a href="subject.html#503">[ subject ]</a>
<a href="author.html#503">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto">More information about the pycrypto
mailing list</a><br>
</body></html>
|