Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
File::HStore(3)	      User Contributed Perl Documentation      File::HStore(3)

       File::HStore - Perl extension to	store files  on	a filesystem using a
	   very	simple hash-based storage.

	 use File::HStore;
	 my $store = File::HStore ("/tmp/.mystore");

	 # Add a file in the store
	 my $id	= $store->add("/foo/bar.txt");

	 # Return the filesystem location of an	id
	 my $location =	$store->getpath($id);

	 # Remove a file by its	id from	the store

       File-HStore  is a very  minimalist perl	library	to  store files	 on a
       filesystem using	a very simple hash-based storage.

       File-HStore  is nothing	more than  a  simple wrapper  interface	to  a
       storage containing a specific directory structure where files are hold
       based on	 their hashes. The  name of the	 directories is	based  on the
       first two  bytes	of the	hexadecimal form of  the digest. The  file is
       stored and named	 with its full hexadecimal form	 in the	corresponding
       prefixed	directory.

       The  current version  is	supporting  the	 SHA-1 and  SHA-2 (256	bits)
       algorithm. The FAT (Free	Archive	Toolkit) format	is also	supported and
       it is  composed of the date  of submission plus the  SHA-2 real digest

       The object  oriented interface to "File::HFile" is  described in	this

       The following methods are provided:

       $store =	File::HStore->new($path,$digest,$prefix)
	   This	constructor  returns a new "File::HFile"  object encapsulating
	   a specific store. The path specifies	 where the HStore is located
	   on the filesystem.  If the  path  is	 not specified,	 the  path
	   ~/.hstore  is used. The digest specifies the	algorithm to be	used
	   (SHA-1 or SHA-2 or the  submission	date  called  FAT).  If	 not
	   specified,  SHA-1  is used. Various digest can be mixed  in the
	   same	path but the utility is	somewhat limited.  The $prefix is only
	   an extension	used  for the FAT (Free	Archive	Format)	format to
	   specify the archive unique name.

	   The $filename is  the file to be added in the  store. The return
	   value is the	hash value ($id) of the	$filename stored. Return undef
	   on error.

	   Return the filesystem location of the file specified	by its hash

	   Return undef	on error.

	   The $hashvalue is the file to be removed from the store.

	   Return false	on success and undef on	error.

       There  is a  web	page  for the  File::HStore module  at	the following
       location	:

       If you  plan to	use a hash-based  storage (like	 File::HStore),	don't
       forget  to read	the following  paper and  check	the  impact  for your
       application :

       An Analysis of Compare-by-hash -

       Please  also   consider	the  security  impact	in  your  application
       concerning  the	statement made	by  the	 NIST  regarding the  overall
       security	impact	of the	SHA-1 vulnereability. In  the use  of storage
       and unique identifier only , the	impact is somewhat very	limited.

       Alexandre "adulau" Dulaunoy, <>

       Copyright (C) 2004-2008 by Alexandre Dulaunoy <>

       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.5 or, at
       your option, any	later version of Perl 5	you may	have available.

perl v5.32.1			  2008-06-01		       File::HStore(3)


Want to link to this manual page? Use this URL:

home | help