def secure_pad(buf):
 key = urandom(5)
 buf = (bytes([19, 51, 123, 238, 240]) + buf)
 buf = (buf + urandom((16 - (len(buf) % 16))))
 enc = xor(buf, key)
 return enc

def secure_pad ( buf ) : key = urandom ( 5 ) buf = ( bytes ( [ 19 , 51 , 123 , 238 , 240 ] ) + buf ) buf = ( buf + urandom ( ( 16 - ( len ( buf ) % 16 ) ) ) ) enc = xor ( buf , key ) return enc
ensure message is padded to block size .