Posted: Sat May 20, 2006 1:53 am Post subject: Archive::Tyd 0.02
Archive::Tyd is a module I created last December or so, for archiving a bunch of files together into one "tied" file, which contains all of the contents of each file within.
I originally created it for use in some of my personal projects, ie. if I ever get around to making a halfway good Perl/Tk game and want users to create stuff for it, but giving them the benefit to protect their creation from others editing it, this is what Tyd is for.
Tyd merges a bunch of files together into one archive, and encodes the results with a special password that the archive creator can define. And without this password (or key for you cryptographers out there), you can't decode the archive and get the files back out of it.
This has some application to bots, as this is basically a means of encoding multiple files together into one secure place. What you do with it is up to your imagination.
The first version wasn't without its own major bugs, so half a year later I dusted off the old code and revamped it a little, and those bugs disappeared so I figured it was high time for a new release.
Now, on to the manpage...
POD wrote:
NAME
Archive::Tyd - Perl extension for simple file archiving.
SYNOPSIS
Code:
use Archive::Tyd;
my $tyd = new Archive::Tyd (password => 'secret password');
# Load an archive.
$tyd->openArchive ("./archive.tyd");
# Add a file.
$tyd->addFile ("./secret image.jpg");
# Write the archive.
$tyd->writeArchive ("./archive.tyd");
# Read the secret rules.
my $rules = $tyd->readFile ("rules.txt");
DESCRIPTION
Tyd is a simple archiving algorith for merging multiple files together and
encrypting the results, hence a password-protected archive.
Tyd Does: Reading and writing of encrypted Tyd archives and file
operations within.
Tyd Does: Load all files into memory. Tyd is not good as a storage device
for a large quanitity of large files. Tyd is best for keeping small text files
and graphics together (maybe to keep a spriteset and definitions for a game?)
Tyd Does Not: support directories within the archive, compression of files,
and many other things that WinZip and GZip support.
METHODS
new (ARGUMENTS)
Creates a new Tyd object. You can pass in defaults here (such as password and
debug).
password (PASSWORD)
(Re)define the password to be used. The default password is 'default'.
openArchive (FILE)
Open the archive and decrypt it with the password. You can load multiple
archives with one object, and even change the password between each one.
writeArchive (FILE)
Writes all the files to the archive using the current password.
addFile (FILEPATH)
Adds FILEPATH to the archive. The file will later be called by its file name,
not the whole path (i.e. just "readme.txt", not "C:/secret folder/readme.txt")
deleteFile (FILENAME)
Delete the file from the archive.
readFile (FILENAME)
Read the file. It will return the binary data of the file (which you can then
save to another file or whatever).
contents
Returns an array of each file in the archive.
filename (FILEPATH) *Internal
Takes a file path and returns its name
cipher ([FORCE]) *Internal
Creates the ciphering object. Supply FORCE for it to recreate the object
forcefully (used when you call the B<password> method to change the password).
WHY
I made this module to use with games I make which will allow users to create their
own quests and store ALL of their data (maps, sound effects, tilesets, etc) into a
single, password-protected file.
This module was not meant to compress files in any way. The resulting archive
should be little more than the original size of all the files archived inside of
it. This algorithm is only for tying files together and password protecting them.
ALGORITHM
The algorithm is quite simple. When not encrypted, the archive file would read
like this:
filename::data
filename::data
filename::data
...
Once the unencrypted file is ready, the entire thing is encrypted using
Crypt::CipherSaber with the password provided and written to the archive.
CHANGES
Code:
Version 0.02
- Fixed some major bugs. In 0.01 version, reading an archive Tyd file and then
re-archiving it from the files in-memory, would for some reason corrupt the file.
This has been repaired.
- Carriage Returns are now filtered in and out correctly.
- Included Tydra--a Perl/Tk interface to Tyd Archive Viewing.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.7 or,
at your option, any later version of Perl 5 you may have available.
Also included in the distribution is Tydra, a Perl/Tk interface to Archive::Tyd. It's like the WinZip of Tyd files. _________________ Current Site (2008) http://www.cuvou.com/