Symmetrical encryption and decryption method for supporting non-aligned data and system thereof
暂无分享,去创建一个
The invention discloses a symmetrical encryption and decryption method for supporting non-aligned data and a system thereof. The encryption method comprises the following steps: S1, grouping data according to a preset length L, and recording the length S in the last grouping; S2, judging whether the length S in the last grouping is equal to L, if so, directly encrypting all groupings, or carrying out step S3; S3, except the last grouping, encrypting the data in each grouping; S4, taking the last L-S bytes of cipher text in the last but one grouping, encrypting together with clear text in the last grouping so as to obtain a new cipher text, and replacing the last L-S bytes of the cipher text in the last but one grouping into the front L-S bytes of the new cipher text, and taking the last S bytes of the new cipher text as the cipher text of the last one grouping. The symmetrical encryption of non-aligned data is supported, so that the filling of insignificant byte count is prevented, the data transmission burden can be eased, the storage space of data is reduced, and the occupation for network bandwidth is reduced.