US 12,355,858 B2
Method and apparatus for encrypting and decrypting and reading and writing messages, computer device, and storage medium
Yan Li, Guangzhou (CN); Dong Li, Guangzhou (CN); and Gengshu Chen, Guangzhou (CN)
Assigned to BIGO TECHNOLOGY PTE. LTD., Singapore (SG)
Appl. No. 17/782,939
Filed by BIGO TECHNOLOGY PTE. LTD., Singapore (SG)
PCT Filed Oct. 13, 2020, PCT No. PCT/CN2020/120578
§ 371(c)(1), (2) Date Jun. 6, 2022,
PCT Pub. No. WO2021/114850, PCT Pub. Date Jun. 17, 2021.
Claims priority of application No. 201911250793.1 (CN), filed on Dec. 9, 2019.
Prior Publication US 2023/0027142 A1, Jan. 26, 2023
Int. Cl. H04L 9/00 (2022.01); H04L 9/06 (2006.01); H04L 9/08 (2006.01)
CPC H04L 9/002 (2013.01) [H04L 9/0643 (2013.01); H04L 9/0869 (2013.01); H04L 2209/16 (2013.01)] 17 Claims
OG exemplary drawing
 
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.