Patent ID: 8655932
Filing Date: 2014-02-18
Classification: H04L

Abstract:
1. A method for converting message to message digest, executed in a computer device, comprising obtaining, by the computer device, an offset from a predetermined position in a data string to be converted; obtaining, by the computer device, predetermined bits of data from the data string to be converted according to the offset; converting, by the computer device, the obtained data to decimal number; and determining, by the computer device, whether the length of the decimal number is smaller than a first predetermined length; if the length of the decimal number is not smaller than the first predetermined length, obtaining data of the first predetermined length from the lower digit of the decimal number successively and taking the obtained data as a converted data; if the length of the decimal number is smaller than the first predetermined length, keeping adding 0 to the upper digit of the decimal number till the first predetermined length is reached, and taking the data with added 0 as the converted data, wherein the predetermined position comprises the first byte, any one middle byte or the last byte of the data string to be converted, obtaining the offset from the predetermined position of the data string to be converted is obtaining 4 bits from the predetermined position of the data string to be converted and taking the decimal number corresponding to the obtained 4 bits as the offset, or the obtaining offset from the predetermined position of the data string to be converted comprising obtaining 4 bits or 8 bits from the corresponding byte in the predetermined position of the data string to be converted; determining whether the decimal number corresponding to the obtained bits is larger than the data string to be converted in length; if the decimal number corresponding to the obtained bits is not larger than the data string to be converted in length, taking the decimal number corresponding to the obtained bits as the offset; if the decimal number corresponding to the obtained bits is larger than the length of the data string to be converted, taking the residue, from the decimal number corresponding to the obtained bits divided by the length of the data string to be converted, as the offset; or taking the differential, from the decimal number corresponding to the obtained bits minus the multiple times of the length of the data string to be converted, as the offset, wherein obtaining the predetermined bits of data from the data string to be converted according to the offset comprises wherein the predetermined formula is BITS=128−LBS4*8, wherein BITS refers to the arithmetic right shifting bits and LBS4 refers to the offset.