<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Read the SSL/TLS RFC for some good ideas.<br>Basically you need out-of-band agreement so both tx and rx applications know what to expect. One possibility is the first 2 bytes of data in each encrypted message can describe the actual length of valid data; followed by some amount of random fill.<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Larry White <ljw1001@gmail.com><br><b><span style="font-weight: bold;">To:</span></b> "erlang-questions@erlang.org" <erlang-questions@erlang.org><br><b><span style="font-weight: bold;">Sent:</span></b> Tuesday, 28 April, 2009
 6:49:01 AM<br><b><span style="font-weight: bold;">Subject:</span></b> [erlang-questions] question regarding symmetric encryption with crypto library<br></font><br>In the past the encryption libraries I've used have accepted an arbitrary string as plain text input.  The des implementation in crypto (and the algorithm itself) seems to require that the the input text be some multiple of 8 bytes long.  I can pad the input string with something to make it n*8 bytes long, but then when I decrypt the string, I have no way of knowing if the returned value was padded and by how much.<br>
<br>This seems like a problem many people must have solved.  What's the right way to do this here? <br><br>thanks much for your help.<br><br><br>
</div></div></div><br>
      <hr size=1>Enjoy a better web experience. Upgrade to the new Internet Explorer 8 optimised for Yahoo!7. <a href="http://au.rd.yahoo.com/search/ie8/mailtagline/*http://us.lrd.yahoo.com/_ylc=X3oDMTJxbnQwdTJhBF9zAzIxNDIwMjU2NTkEdG1fZG1lY2gDVGV4dCBMaW5rBHRtX2xuawNVMTEwMzQ0OAR0bV9uZXQDWWFob28hBHRtX3BvcwN0YWdsaW5lBHRtX3BwdHkDYXVueg--/SIG=11k6t9t1c/**http://downloads.yahoo.com/au/internetexplorer/" target=_blank>Get it now.</a>.</body></html>