The invention discloses a file packing and reading method based on Hash. The
packing method comprises the steps as follows: reading files required to be packed in sequence; calculating the Hash values of the paths of the files; writing the files into a file data region; writing the Hash values and the offset values of the files into a
Hash table; and finishing the writing operation of all the files. The reading method comprises the steps as follows: obtaining the Hash values of the paths of the files in the packs through read-in file index information; searching the corresponding offset values in the
Hash table; and reading data files corresponding to the offset values in the file data region. According to the file packing and reading method, the identifications of the files in the packs adopt the Hash values and the string matching operation does not need to be performed in the search process; the indexes adopt the
Hash table, so that the offset addresses can be quickly positioned; and the original
directory structure cannot be recovered through the files in the packs. The file packing and reading method can be widely applied to the field of
computer software.