The invention discloses a high-capacity file
encryption method and
system based on block
processing. According to the method, a high-capacity file is read and encrypted in blocks according to the fixed size, the situation that the high-capacity file is wholly loaded to a memory is avoided, memory occupation is reduced, and efficient
encryption is achieved; two symmetric
encryption algorithms of SM4 and AES are supported, and the corresponding
algorithm is automatically identified and called during decryption by embedding an
algorithm identifier in an encrypted file; and generating a check code for the encrypted file by using SM3 for
integrity check before decryption. A file path coding mode irrelevant to a platform is adopted, a
Unicode path is supported, and mainstream operating systems such as Windows and Linux can be compatible; and meanwhile, a buffer area and a multi-thread mechanism are introduced, so that file I / O operation and encryption calculation are executed in parallel, and the encryption efficiency is improved by utilizing the advantages of a multi-core processor. According to the method, the problems of
high memory occupation, inconvenience in
algorithm switching, poor cross-platform compatibility and low encryption efficiency of high-capacity file encryption are solved, and the method has a wide application prospect.