| CPC H04L 9/002 (2013.01) [H04L 9/0643 (2013.01); H04L 9/0869 (2013.01); H04L 2209/16 (2013.01)] | 17 Claims |

|
1. A method for encrypting messages, comprising:
generating a seed by a white-box encryption application programming interface, upon receiving an original message, wherein the seed is unique, and is at least one of a number, a string and a character;
generating a mask based on the seed by: determining a length of the original message; determining a hash function; and generating the mask having a length equal to the length of the original message by inputting the seed into the hash function for operation or determining a length of the original message; and generating the mask having a length equal to the length of the original message by performing white-box encryption on the seed;
generating a masked message by masking an original message using the mask;
acquiring a target message by performing white-box encryption on the masked message; and
disclosing the target message and the seed;
wherein the hash function comprises a SHAKE function or a secure hash algorithm (SHA) function, and generating the mask having the length equal to the length of the original message by inputting the seed into the hash function for operation comprises:
outputting the mask having the length equal to the length of the original message by inputting the seed into the SHAKE function for operation; or
generating a plurality of new seeds based on the seed, outputting a plurality of pieces of digest information by inputting the plurality of new seeds into the SHA function for operation, acquiring a first data set by combining the plurality of pieces of digest information; and extracting data having a length equal to the length of the original message as the mask from the first data set.
|