Crypt::AllOrNothing::Util - Util functions for Crypt::AllOrNothing
use Crypt::AoN::Util qw/:all/; $randomValue = randomValue(size=>128, return=>'ascii'); @brokenString = breakString(string=>$string, size=>$size); addLength_andPad(array=>\@array, size=>$packetSize); remLength_andPad(array=>\@array); $charString = largeNumToChar(size=>$size, number=>$number);
randomValue breakString addLength_andPad remLength_andPad largeNumToChar
This function takes an array as proccessed by addLength_andPad and removes the padding and length from it. 'array' is a reference to the array to be processed. This is processed inline, the array you pass will be changed when the function returns.
This function takes an array of strings and appends the total length of all the items in the array to the end of the array, padding with specified characters to make the last item in teh array the same length as the rest of the items. 'array' is a reference to the array to be processed. This is processed inline, the array you pass will be changed when the function returns. The array must conform to a few guidelines to work with this function. All elements other than the last must be the same length. The last element must be less than or equal to the size of the rest. The elements must be at least 4 bytes large. 'size' is the packet size in bytes(ie:characters). this must be greater than 4 'padding' is a string containing the padding to be used. The first character of this string will be used to fill all places needing padding. If this parameter is not passed, each padding byte will be a random character(0x00..0xFF)
This function breaks up a string into an array with each item in the array of length given. This does no padding, so the last item in the array may be shorter. Please see addLength_andPad. 'size' is the number of bytes, or characters each segment should be 'string' is the string to be broken
'size' is the number of bits to be in the created randomValue. it can be any value greater than 0, 128 is the default if nothing is passed 'return' can currently be 'ascii', 'hex', 'base64', or 'int'. If ascii, the size of the returned value will be exactly that passed, if hex, it will be twice that passed, if base64, 4/3 that passed, if int, the bitsize will be that passed, or possibly a few bits smaller.
This function takes a large number and converts it to a character string which it returns. 'size' is the number of bits the final character string should have. 'number' is the number to convert
<timothy.zander at alum.rpi.edu>
Please report any bugs or feature requests to
bug-crypt-aon-util at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Crypt-AllOrNothing-Util. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Crypt::AllOrNothing::Util perldoc Crypt::AllOrNothing
You can also look for information at:
Thanks to Prof. Bulent Yener at RPI for his assistance.
Copyright 2007 Timothy Zander, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.