TWI755029B - Data processing method, device, electronic device and storage medium - Google Patents
Data processing method, device, electronic device and storage medium Download PDFInfo
- Publication number
- TWI755029B TWI755029B TW109127995A TW109127995A TWI755029B TW I755029 B TWI755029 B TW I755029B TW 109127995 A TW109127995 A TW 109127995A TW 109127995 A TW109127995 A TW 109127995A TW I755029 B TWI755029 B TW I755029B
- Authority
- TW
- Taiwan
- Prior art keywords
- data
- value
- hash
- sub
- electronic device
- Prior art date
Links
- 238000003672 processing method Methods 0.000 title claims description 31
- 238000000034 method Methods 0.000 claims abstract description 14
- 238000004590 computer program Methods 0.000 claims description 11
- 238000001514 detection method Methods 0.000 claims 2
- 230000001939 inductive effect Effects 0.000 claims 2
- 230000004907 flux Effects 0.000 claims 1
- 239000000126 substance Substances 0.000 claims 1
- 230000006870 function Effects 0.000 description 12
- 230000011218 segmentation Effects 0.000 description 9
- 238000004422 calculation algorithm Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 3
- 238000012795 verification Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 238000007781 pre-processing Methods 0.000 description 2
- 241000700605 Viruses Species 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 238000005265 energy consumption Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本發明涉及一種資料處理技術領域,尤其涉及一種資料處理方法、裝置、電子設備及存儲介質。 The present invention relates to the technical field of data processing, and in particular, to a data processing method, device, electronic device and storage medium.
隨著一些感測器和智慧設備的大規模應用,在當前全球電子互聯互通的時代,由於病毒、駭客、電子竊取等的出現,這些硬體設備的資訊安全性比在任何時候都顯得重要,然而這些硬體設備往往會受到各方面資源的限制,如中央處理器(central processing unit,CPU)的計算能力、記憶體及耗能等,這些均會導致傳統的雜湊處理方法應用受限。 With the large-scale application of some sensors and smart devices, in the current era of global electronic interconnection, due to the emergence of viruses, hackers, electronic theft, etc., the information security of these hardware devices is more important than ever. However, these hardware devices are often limited by various resources, such as the computing power, memory, and energy consumption of a central processing unit (CPU), which limit the application of traditional hash processing methods.
有鑑於此,有必要提供一種資料處理方法、裝置、電子設備及存儲介質,可以不受硬體的記憶體限制,對硬體設備進行資料處理。 In view of this, it is necessary to provide a data processing method, apparatus, electronic device and storage medium, which can perform data processing on the hardware device without being limited by the memory of the hardware.
本申請一實施方式提供一種資料處理方法,包括:獲取初始雜湊資料及固定值,其中,所述初始雜湊資料包括電子設備待處理的資料,所述固定值包括所述電子設備的記憶體緩存固定值;在所述初始雜湊資料的數值大於所述固定值時,將所述初始雜湊資料分割成N個子資料,其中,每一子資料的數值小於或等於所述固定值,N為大於1的整數; 將所述子資料登錄至所述電子設備記憶體,以獲得所述子資料進行雜湊處理後的第一雜湊值;及根據每一子資料的所述第一雜湊值得到處理結果。 An embodiment of the present application provides a data processing method, including: acquiring initial hash data and a fixed value, wherein the initial hash data includes data to be processed by an electronic device, and the fixed value includes a memory cache fixed value of the electronic device value; when the value of the initial hash data is greater than the fixed value, the initial hash data is divided into N sub-data, wherein the value of each sub-data is less than or equal to the fixed value, and N is greater than 1 integer; Logging the sub-data into the memory of the electronic device to obtain a first hash value after hashing the sub-data; and obtaining a processing result according to the first hash value of each sub-data.
根據本申請的一些實施方式,所述根據每一子資料的所述第一雜湊值得到處理結果的步驟包括:將每一子資料的所述第一雜湊值串成字串;及根據所述字串得到處理結果。 According to some embodiments of the present application, the step of obtaining a processing result according to the first hash value of each sub-data comprises: stringing the first hash value of each sub-data into a string; and according to the The string gets the processing result.
根據本申請的一些實施方式,所述根據所述字串得到處理結果的步驟包括:在所述字串大於所述固定值時,循環以下步驟直到新的字串的數值小於或等於所述固定值:將大於所述固定值的字串分割成M個子字串,M為大於1的整數;將所述子字串輸入至所述電子設備記憶體,以獲得所述子字串進行雜湊處理後的第二雜湊值;及根據每一子字串的所述第二雜湊值得到新的字串。 According to some embodiments of the present application, the step of obtaining the processing result according to the character string includes: when the character string is greater than the fixed value, repeating the following steps until the value of the new character string is less than or equal to the fixed value Value: Divide a string larger than the fixed value into M substrings, where M is an integer greater than 1; input the substring into the memory of the electronic device to obtain the substring for hashing processing and obtaining a new string according to the second hash value of each substring.
根據本申請的一些實施方式,所述根據所述字串得到處理結果的步驟包括:在所述字串的數值小於或等於所述固定值時,將所述字串作為處理結果。 According to some embodiments of the present application, the step of obtaining the processing result according to the character string includes: when the value of the character string is less than or equal to the fixed value, using the character string as the processing result.
根據本申請的一些實施方式,所述資料處理方法進一步包括:在所述初始雜湊資料的數值小於或等於所述固定值時,將所述初始雜湊資料登錄至所述電子設備記憶體,以獲得該初始雜湊資料進行雜湊處理後得到的處理結果。 According to some embodiments of the present application, the data processing method further includes: when the value of the initial hash data is less than or equal to the fixed value, logging the initial hash data into the electronic device memory to obtain The processing result obtained after the initial hash data is hashed.
根據本申請的一些實施方式,所述資料處理方法進一步包括: 獲取大小隨機值;根據所述大小隨機值進行分割,以得到數值相同或不同的分割值。 According to some embodiments of the present application, the data processing method further comprises: Obtain a random value of size; perform segmentation according to the random value of size to obtain segmentation values with the same or different values.
本申請一實施方式提供一種資料處理裝置,包括:獲取模組,用於獲取初始雜湊資料及固定值,其中,所述初始雜湊資料包括電子設備待處理的資料,所述固定值包括所述電子設備的記憶體緩存固定值;分割模組,用於在所述初始雜湊資料的數值大於所述固定值時,將所述初始雜湊資料分割成N個子資料,其中,每一子資料的數值小於或等於所述固定值,N為大於1的整數;雜湊模組,用於將所述子資料登錄至所述電子設備記憶體,以獲得該子資料進行雜湊處理後的第一雜湊值;及結果模組,用於根據每一子資料的所述第一雜湊值得到處理結果。 An embodiment of the present application provides a data processing device, including: an acquisition module for acquiring initial hash data and a fixed value, wherein the initial hash data includes data to be processed by an electronic device, and the fixed value includes the electronic device. The memory of the device caches a fixed value; the dividing module is used to divide the initial hash data into N sub-data when the value of the initial hash data is greater than the fixed value, wherein the value of each sub-data is less than or equal to the fixed value, and N is an integer greater than 1; the hash module is used to log the sub-data into the memory of the electronic device to obtain the first hash value of the sub-data after hashing; and The result module is used for obtaining a processing result according to the first hash value of each sub-data.
優選地,所述結果模組包括:字串單元,用於將每一子資料的所述第一雜湊值串成字串;結果單元,用於根據所述字串得到處理結果。 Preferably, the result module includes: a string unit for stringing the first hash value of each sub-data into a string; and a result unit for obtaining a processing result according to the string.
本申請一實施方式提供一種電子設備,其中,所述電子設備包括:記憶體及一個或多個處理器;記憶體,用於存儲待處理的資料;當一個或多個程式被所述一個或多個處理器執行,使得所述一個或多個處理器實現如上任一實施方式所述的資料處理方法。 An embodiment of the present application provides an electronic device, wherein the electronic device includes: a memory and one or more processors; the memory is used to store data to be processed; when one or more programs are executed by the one or more processors A plurality of processors execute, such that the one or more processors implement the data processing method described in any of the above embodiments.
本申請一實施方式提供一種電腦可讀存儲介質,其上存儲有電腦 程式,所述電腦程式被處理器執行時實現如上任一實施方式所述的資料處理方法。 An embodiment of the present application provides a computer-readable storage medium on which a computer is stored A program, when the computer program is executed by the processor, implements the data processing method described in any of the above embodiments.
本申請實施方式提供的資料處理方法、裝置、電子設備及存儲介質,包括通過預先比較初始雜湊資料的數值與電子設備的記憶體緩存固定值大小,在所述初始雜湊資料的數值大於電子設備的記憶體緩存固定值時,將所述初始雜湊資料分割成N個子資料,以使得每一子資料的數值大小小於或等於電子設備的記憶體緩存固定值,解決因電子設備的記憶體大小受限無法實現雜湊處理的問題,針對每一子資料,根據初始向量進行雜湊處理,得到第一雜湊值,根據每一子資料的第一雜湊值得到處理結果,完成電子設備上待處理資料的雜湊處理。 The data processing method, device, electronic device, and storage medium provided by the embodiments of the present application include comparing the value of the initial hash data with the fixed value of the memory cache of the electronic device in advance, where the value of the initial hash data is greater than the value of the electronic device. When the memory caches a fixed value, the initial hash data is divided into N sub-data, so that the numerical size of each sub-data is less than or equal to the fixed value of the memory cache of the electronic device, so as to solve the problem of limited memory size of the electronic device. For the problem that hash processing cannot be implemented, for each sub-data, hash processing is performed according to the initial vector to obtain the first hash value, and the processing result is obtained according to the first hash value of each sub-data, and the hash processing of the data to be processed on the electronic device is completed. .
100:電子設備 100: Electronics
10:資料處理裝置 10: Data processing device
11:記憶體 11: Memory
12:處理器 12: Processor
圖1是現有雜湊運算的流程示意圖;圖2為根據本申請一實施方式的電子設備結構示意圖;圖3為根據本申請一實施方式的資料處理方法的流程圖;圖4為根據本申請一實施方式的資料分割示意圖;圖5為根據本申請一實施方式的另一資料處理方法的流程圖;圖6為根據本申請一實施方式的資料處理裝置的示意圖。 FIG. 1 is a schematic flowchart of an existing hash operation; FIG. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application; FIG. 3 is a flowchart of a data processing method according to an embodiment of the present application; FIG. 4 is an embodiment of the present application. FIG. 5 is a flowchart of another data processing method according to an embodiment of the present application; FIG. 6 is a schematic diagram of a data processing apparatus according to an embodiment of the present application.
下面將結合本發明實施方式中的附圖,對本發明實施方式中的技術方案進行清楚、完整地描述,顯然,所描述的實施方式是本發明一部分實施方式,而不是全部的實施方式。基於本發明中的實施方式,本領域普通技術人 員在沒有付出創造性勞動前提下所獲得的所有其他實施方式,都屬於本發明保護的範圍。 The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, those of ordinary skill in the art All other implementations obtained by the member without creative efforts shall fall within the protection scope of the present invention.
基於本申請中的實施方式,本領域普通技術人員在沒有付出創造性勞動前提下所獲得的所有其他實施方式,都是屬於本申請保護的範圍。 Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the protection scope of the present application.
為了便於本領域技術人員深入理解本申請實施例,以下將首先介紹本申請實施例中所涉及的專業術語的定義。 In order to facilitate the in-depth understanding of the embodiments of the present application by those skilled in the art, the following will firstly introduce definitions of technical terms involved in the embodiments of the present application.
雜湊就是把任意長度的輸入通過散列演算法變換成固定長度輸出,該輸出就是散列值,散列值的空間通常遠小於輸入的空間。雜湊函數就是將任意長度的消息壓縮到某一固定長度的消息摘要的函數。雜湊函數H(x)的定義:H(x1)=h1,H(x2)=h2,h1和h2的長度必須相同。H(x1)=h1,H(x2)=h2,如果h1=h2,x1必須等於x2。如果x1和x2不同,h1和h2相同的概率非常低。H(x1)=h1,x1無法從h1反轉得到。雜湊演算法可以根據電子設備100及該電子設備100上的應用而進行相應應用,例如可以應用在錯誤校正、語音辨識以及資訊安全方面,資訊安全可以包括檔校驗、數位簽章及鑒權協議。
Hash is to transform an input of any length into a fixed-length output through a hash algorithm, and the output is a hash value, and the space of the hash value is usually much smaller than the space of the input. A hash function is a function that compresses a message of any length into a message digest of a fixed length. Definition of hash function H(x): H(x1)=h1, H(x2)=h2, h1 and h2 must have the same length. H(x1)=h1, H(x2)=h2, if h1=h2, x1 must be equal to x2. If x1 and x2 are different, the probability that h1 and h2 are the same is very low. H(x1)=h1, x1 cannot be reversed from h1. The hash algorithm can be applied according to the
軟體實現的雜湊處理方法流程,PC機上安裝64位元作業系統,配置有相應的處理器及靜態記憶體記憶體,並安裝了相應的軟體運行平臺,使用者輸入資料後,運行平臺就會對這些資料進行如圖1所示的操作,其中,110:雜湊的輸入資料,即初始雜湊資料。120:用於雜湊計算的輸入資料的子塊。130:初始向量。140:雜湊函數。150:內部雜湊狀態值。160:最終雜湊值。雜湊處理是資料塊與雜湊函數計算,將輸入的資料分成子塊,對於第一個塊,使用初始向量進行雜湊運算,得到了內部雜湊狀態值,將第一個塊的內部雜湊狀態值作為初始向量輸出給第二塊,依次類推,計算得到最終的雜湊值。 The process of the hash processing method implemented by the software, the 64-bit operating system is installed on the PC, the corresponding processor and static memory are configured, and the corresponding software running platform is installed. After the user enters the data, the running platform will be The operations as shown in FIG. 1 are performed on these data, wherein 110: hashed input data, ie, initial hash data. 120: Sub-block of input data for hash calculation. 130: Initial vector. 140: Hash function. 150: Internal hash status value. 160: Final hash value. Hash processing is the calculation of data block and hash function. The input data is divided into sub-blocks. For the first block, the initial vector is used to perform hash operation, and the internal hash state value is obtained, and the internal hash state value of the first block is used as the initial value. The vector is output to the second block, and so on, to calculate the final hash value.
需要說明的是,雜湊處理可以由軟體或硬體實現,在由軟體實現 雜湊運算時,其在輸入資料時是一次輸入全部資料至記憶體,然後由軟體對全部資料進行處理,在處理過程中會涉及到對資料的劃分,對資料劃分成子塊是雜湊運算的一個預處理操作,目的在於使輸入的全部資料符合規範的格式。在由硬體實現雜湊運算時,硬體設備受到其資源限制,例如硬體設備記憶體大小,其無法存儲超過其記憶體大小的資料,進而無法通過硬體實現。本申請針對該問題提出一種資料處理方法,以通過該資料處理方法可以由硬體實現資料的雜湊處理。 It should be noted that hash processing can be implemented by software or hardware. In hash operation, when inputting data, all data is input to the memory at one time, and then all data is processed by the software. In the process of processing, data division will be involved. Dividing data into sub-blocks is a pre-processing step of hash operation. The purpose of the processing operation is to make all the input data conform to the standard format. When the hash operation is implemented by hardware, the hardware device is limited by its resources, such as the memory size of the hardware device, which cannot store data exceeding its memory size, and thus cannot be implemented by hardware. The present application proposes a data processing method for this problem, so that the data hash processing can be realized by hardware through the data processing method.
請參閱圖2,資料處理裝置10運行於電子設備100中。所述電子設備100包括,但不僅限於,記憶體11及至少一個處理器12,上述元件之間可以通過匯流排連接。
Please refer to FIG. 2 , the
需要說明的是,圖2僅為舉例說明電子設備100。在其他實施方式中,電子設備100也可以包括更多或者更少的元件,或者具有不同的元件配置。所述電子設備100可以包括各種物聯網終端或設備,可以包括手機、智慧手錶、智慧音箱、虛擬實境設備、平板電腦、膝上型可攜式電腦、車載電腦、臺式電腦、電子書閱讀器、MP3播放機、MP4播放機、機上盒、可穿戴設備等等。
It should be noted that FIG. 2 only illustrates the
在一個實施方式中,所述記憶體11為該電子設備100的記憶體,用於存儲待處理的資料。所述資料處理裝置10與所述記憶體11邏輯相連,從而通過所述資料處理裝置10將資料登錄至所述記憶體11。所述處理器12與所述記憶體11相連,直接定址所述記憶體11,獲取待處理的資料進行運算處理,完成雜湊處理的硬體實現等功能。
In one embodiment, the
本申請實施例所述資料處理裝置10可以實現為用戶端或外掛程式,電子設備100可以從遠端伺服器獲取並安裝該外掛程式,從而通過該用戶端或外掛程式來實施本申請實施例所提供的資料處理方法。用戶端可以包括至少一個應用程式,該用戶端能夠運行在電子設備100上,從而實現本申請實施例的
資料處理方法。外掛程式可以包括運行在電子設備100的應用程式中,從而可以實現本申請實施例提供的資料處理方法。
The
請參閱圖3,圖3為根據本申請一實施方式的資料處理方法的流程圖。其中,資料處理方法包括以下步驟。 Please refer to FIG. 3 , which is a flowchart of a data processing method according to an embodiment of the present application. The data processing method includes the following steps.
步驟S00:獲取資料處理指令。 Step S00: Obtain a data processing instruction.
在本申請實施例中,可以在電子設備100要進行至少包括如下雜湊處理時獲取資料處理指令:錯誤校正、語音辨識、檔校驗、數位簽章及鑒權協議等。在進行雜湊處理時,可以由進行雜湊處理的進程或程式輸出一資料處理指令,或是進行雜湊處理時觸發資料處理裝置10,以輸出一資料處理指令,資料處理裝置10會獲取該資料處理指令,根據該指令開始執行以下步驟,以保證雜湊處理能由硬體實現。
In this embodiment of the present application, data processing instructions may be obtained when the
步驟S10:獲取初始雜湊資料及固定值,其中,初始雜湊資料包括電子設備100待處理的資料,固定值包括電子設備100中的記憶體11的記憶體緩存固定值。
Step S10 : Obtain initial hash data and a fixed value, wherein the initial hash data includes data to be processed by the
在本申請實施例中,資料處理裝置10根據步驟S00獲得資料處理指令讀取相應的初始雜湊資料及固定值。例如,在要進行檔校驗時,需要獲得待校驗的檔的資料。可以理解,初始雜湊資料是要進行資料處理的資料,可以包括數位資訊、IP資訊包及磁片檔等。
In the embodiment of the present application, the
在本申請實施例中,不同的兩個電子設備100,其記憶體11的記憶體固定值可相同或不相同,可以理解每個記憶體11的記憶體值可相同也可不相同,具體根據記憶體11的實際記憶體確定。對於確定的電子設備100,其記憶體值是固定的。通過讀取記憶體11的參數記憶體容量,獲得記憶體11可以緩存的資料數值大小,比如64MB、128MB、256MB等。
In the embodiment of the present application, the fixed memory values of the
步驟S20:判斷所述初始雜湊資料是否大於固定值。 Step S20: Determine whether the initial hash data is greater than a fixed value.
在本申請實施例中,資料處理裝置10要比較初始雜湊資料與固定值的大小,判斷初始雜湊資料是否大於固定值,以檢測該記憶體11是否能存儲得下該初始雜湊資料。
In the embodiment of the present application, the
資料處理裝置10判斷得到初始雜湊資料的數值不大於固定值,即小於或等於所述固定值時,進行步驟S60。
When the
步驟S60:在初始雜湊資料的數值小於或等於固定值時,將初始雜湊資料登錄至電子設備記憶體,以獲得該初始雜湊資料進行雜湊處理後得到的處理結果。 Step S60: When the value of the initial hash data is less than or equal to a fixed value, log the initial hash data into the memory of the electronic device to obtain a processing result obtained by hashing the initial hash data.
在本申請實施例中,初始雜湊資料的數值小於或等於固定值,即初始雜湊資料能夠直接存儲進記憶體,直接將雜湊資料輸入至記憶體11,電子設備100的處理器12直接定址記憶體11獲取相應資料,對獲得的雜湊資料進行雜湊處理。
In the embodiment of the present application, the value of the initial hash data is less than or equal to a fixed value, that is, the initial hash data can be directly stored in the memory, the hash data can be directly input into the
資料處理裝置10判斷得到初始雜湊資料的數值大於固定值時,進行步驟S30。
When the
步驟S30:在初始雜湊資料的數值大於固定值時,將所述初始雜湊資料分割成N個子資料,其中,每一子資料的數值小於或等於所述固定值,並且N為大於1的整數。 Step S30: When the value of the initial hash data is greater than a fixed value, divide the initial hash data into N sub-data, wherein the value of each sub-data is less than or equal to the fixed value, and N is an integer greater than 1.
在本申請實施例中,區別軟體實現時所進行的資料分割,本申請實施例的初始雜湊資料分割目的在於,在要進行雜湊處理的資料其數值太大無法存儲進電子設備100的記憶體11時,對該資料進行分割,分割得到的子資料分批輸入至記憶體11,即以“時間換空間”的方式將原本無法輸入的初始雜湊資料登錄至記憶體11。
In the embodiment of the present application, the data division performed during the software implementation is distinguished. The purpose of the initial hash data division in the embodiment of the present application is that the value of the data to be hashed is too large to be stored in the
在本申請實施例中,具體分割方式可以包括但不限於隨機大小分
割和固定分割。隨機大小分割包括預先生成一組大小隨機值,資料處理裝置10根據要進行分割的份數獲取相應個數的大小隨機值,根據獲取的這組大小隨機值對初始雜湊資料進行大小隨機分割,分割出的每個子資料的大小可相同或不相同,在初始向量被洩露,基於初始雜湊資料的拆分大小是隨機的,其最終的雜湊值也無法計算得到。還可以根據預設的大小值進行固定分割,即根據預先設置的預設值對初始雜湊資料進行分割,使得分割後的子資料大小等於預設值,且使得分割後得到的資料大小均相同且小於或等於固定值。
In this embodiment of the present application, the specific segmentation method may include, but is not limited to, random size segmentation
Cut and fixed division. The random size division includes generating a set of size random values in advance, the
在本申請實施例中,圖4中分割後的子資料330的數值小於或等於所述固定值,基於上述的隨機大小分割或固定分割,各個子資料330的大小可以相同也可以不相同。分割的子資料330的數量N可以根據實際情況設定。 In this embodiment of the present application, the value of the divided sub-data 330 in FIG. 4 is less than or equal to the fixed value. Based on the above random size division or fixed division, the sizes of each sub-data 330 may be the same or different. The number N of divided sub-data 330 can be set according to actual conditions.
步驟S40:將子資料登錄至電子設備記憶體,以獲得該子資料進行雜湊處理後的第一雜湊值。 Step S40: Register the sub-data in the memory of the electronic device to obtain a first hash value of the sub-data after hash processing.
在本申請實施例中,通過大小隨機值可以得到一組大小不固定的子資料,資料處理裝置10將分割好的子資料輸入至記憶體11後,處理器12直接定址記憶體11讀取到相應的子資料,對每一子資料單獨進行雜湊運算得到對應的第一雜湊值。可以通過圖4中的雜湊函數340進行雜湊計算。具體的雜湊運算過程可以參考圖1,可以包括對輸入的子資料進行預處理之後通過雜湊函數進計算,雜湊處理的具體演算法可以參考MD4、MD5、SHA-1、SHA-256、SHA-384及SHA-512等,本申請對此不再贅述。
In the embodiment of the present application, a group of sub-data with variable size can be obtained through random values. After the
步驟S50:根據每一子資料的所述第一雜湊值得到處理結果。 Step S50: Obtain a processing result according to the first hash value of each sub-data.
在申請實施例中,通過對每一子資料進行雜湊處理後得到的第一雜湊值,其就是初始雜湊資料進行資料處理後的結果,所述資料處理裝置10通過讀取該第一雜湊值可以得到資料處理的結果。可以理解本申請實施例中提到
的第一雜湊值或第二雜湊值即為通過對初始雜湊資料進行雜湊運算得到的一組二進位值。
In the application embodiment, the first hash value obtained by hashing each sub-data is the result of performing data processing on the initial hash data, and the
根據本申請的一些實施方式,參見圖5,步驟S50根據每一子資料的所述第一雜湊值得到處理結果,具體可以通過以下步驟進行: According to some embodiments of the present application, referring to FIG. 5 , step S50 obtains a processing result according to the first hash value of each sub-profile, which may be specifically performed by the following steps:
步驟S51:將每一子資料的所述第一雜湊值串成字串。 Step S51: String the first hash value of each sub-data into a string.
在本申請實施例中,如圖4所示,資料處理裝置10將每一子資料330的第一雜湊值350串成字串360,該字串就是本申請的資料處理裝置10對初始雜湊資料進行處理得到的結果,資料處理裝置10根據所述字串得到處理結果。
In the embodiment of the present application, as shown in FIG. 4 , the
步驟S52:判斷字串是否大於固定值。 Step S52: Determine whether the character string is greater than a fixed value.
根據本申請的一些實施方式,資料處理裝置10判斷所述字串的數值小於或等於所述固定值時,進行步驟S53。
According to some embodiments of the present application, when the
步驟S53:在字串的數值大小小於或等於所述固定值時,將該字串作為處理結果。 Step S53: When the numerical value of the character string is less than or equal to the fixed value, use the character string as the processing result.
在本申請實施例中,資料處理裝置10對字串和固定值比較後,得到字串的數值小於或等於固定值時,則資料處理裝置10可以直接將該字串作為最終結果存儲於記憶體11,由處理器12定址該記憶體11獲得雜湊處理結果,將該字串作為處理結果輸出。
In the embodiment of the present application, after the
根據本申請的一些實施方式,資料處理裝置10判斷所述字串的數值大於所述固定值時,循環以下步驟直到新的字串的數值大小小於或等於所述固定值。
According to some embodiments of the present application, when the
在本申請實施例中,資料處理裝置10比較由第一雜湊值串成的字符串與固定值的大小,在字串大於固定值時進行多次雜湊運算,增加碰撞攻擊的複雜性。
In the embodiment of the present application, the
步驟S54:將大於固定值的字串分割成M個子字串,M為 大於1的整數。 Step S54: Divide the string larger than the fixed value into M substrings, where M is Integer greater than 1.
在本申請實施例中,在進行步驟S54時,具體分割方式可以參考上述的大小隨機分割或固定分割,以得到數值相同或不同的分割值,本申請對此不作具體限定。 In this embodiment of the present application, when step S54 is performed, the specific segmentation method may refer to the foregoing random segmentation or fixed segmentation to obtain segmentation values with the same or different values, which are not specifically limited in this application.
步驟S55:將子字串輸入至電子設備的記憶體,以獲得該子字串進行雜湊處理後的第二雜湊值。 Step S55: Input the substring into the memory of the electronic device to obtain a second hash value after hashing the substring.
在本申請實施例中,雜湊處理的具體操作原理與步驟S40相類似,在此不再贅述。 In this embodiment of the present application, the specific operation principle of the hash processing is similar to that of step S40, and details are not described herein again.
步驟S56:根據每一子字串的所述第二雜湊值得到新的字串。 Step S56: Obtain a new string according to the second hash value of each substring.
在本申請實施例中,資料處理裝置10將每一子字串的所述第二雜湊值得到新的字串的數值繼續與固定值比較,直到最後得到的字串的數值大小小於固定值。
In the embodiment of the present application, the
請參閱圖6,在本實施方式中,所述資料處理裝置10可以被分割成一個或多個模組,所述一個或多個模組可存儲在所述處理器12中,並由所述處理器12執行本申請實施例的資料處理方法。所述一個或多個模組可以是能夠完成特定功能的一系列電腦程式指令段,所述指令段用於描述所述資料處理裝置10在所述電子設備100中的執行過程。例如,所述資料處理裝置10可以被分割成圖6中的獲取模組21、分割模組22、雜湊模組23及結果模組24。
Referring to FIG. 6, in this embodiment, the
獲取模組21用於獲取初始雜湊資料及固定值,其中,所述初始雜湊資料包括電子設備待處理的資料,所述固定值包括所述記憶體的記憶體緩存固定值。
The obtaining
分割模組22用於在所述初始雜湊資料的數值大小大於所述固定
值時,將所述初始雜湊資料分割成N個子資料,其中,每一子資料的數值小於或等於所述固定值,N為大於1的整數。
The
雜湊模組23用於將所述子資料登錄至所述記憶體,以獲得該子資料進行雜湊處理後的第一雜湊值。 The hashing module 23 is used for logging the sub-data into the memory to obtain the first hash value after hashing the sub-data.
結果模組24用於根據每一子資料的所述第一雜湊值得到處理結果。
The
根據本申請的一些實施方式,結果模組24包括:字串單元241用於將每一子資料的所述第一雜湊值串成字符串。
According to some embodiments of the present application, the
結果單元242用於根據所述字串得到處理結果。 The result unit 242 is used for obtaining a processing result according to the character string.
通過該資料處理裝置10可以對所述初始雜湊資料進行處理,以將其能存儲進記憶體,完成雜湊處理的硬體實現。具體內容可以參見上述資料處理方法的實施例,在此不再詳述。
The initial hash data can be processed by the
本申請實施方式提供的資料處理方法、裝置、電子設備及存儲介質,包括通過預先比較初始雜湊資料的數值與電子設備100的記憶體緩存固定值大小,在所述初始雜湊資料的數值大於電子設備100的記憶體緩存固定值時,將所述初始雜湊資料分割成N個子資料,以使得每一子資料的數值大小小於或等於電子設備100的記憶體緩存固定值,解決因電子設備100的記憶體大小受限無法實現雜湊處理的問題,針對每一子資料,根據初始向量進行雜湊處理,得到第一雜湊值,根據每一子資料的第一雜湊值得到處理結果,完成電子設備100上待處理資料的雜湊處理。
The data processing method, device, electronic device, and storage medium provided by the embodiments of the present application include comparing the value of the initial hash data with the fixed value of the memory cache of the
在一實施方式中,所述處理器12可以是中央處理單元(Central Processing Unit,CPU),還可以是其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、
現成可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件等。通用處理器可以是微處理器或者所述處理器12也可以是其它任何常規的處理器等。
In one embodiment, the
所述資料處理裝置10中的模組如果以軟體功能單元的形式實現並作為獨立的產品銷售或使用時,可以存儲在一個電腦可讀取存儲介質中。基於這樣的理解,本申請實現上述實施例方法中的全部或部分流程,也可以通過電腦程式來指令相關的硬體來完成,所述的電腦程式可存儲於一電腦可讀存儲介質中,所述電腦程式在被處理器執行時,可實現上述各個方法實施例的步驟。其中,所述電腦程式包括電腦程式代碼,所述電腦程式代碼可以為原始程式碼形式、物件代碼形式、可執行檔或某些中間形式等。所述電腦可讀介質可以包括:能夠攜帶所述電腦程式代碼的任何實體或裝置、記錄介質、隨身碟、移動硬碟、磁碟、光碟、電腦記憶體、唯讀記憶體(ROM,Read-Only Memory)、隨機存取記憶體(RAM,Random Access Memory)、電載波信號、電信信號以及軟體分發介質等。需要說明的是,所述電腦可讀介質包含的內容可以根據司法管轄區內立法和專利實踐的要求進行適當的增減,例如在某些司法管轄區,根據立法和專利實踐,電腦可讀介質不包括電載波信號和電信信號。
If the modules in the
可以理解的是,以上所描述的模組劃分,為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。另外,在本申請各個實施例中的各功能模組可以集成在相同處理單元中,也可以是各個模組單獨物理存在,也可以兩個或兩個以上模組集成在相同單元中。上述集成的模組既可以採用硬體的形式實現,也可以採用硬體加軟體功能模組的形式實現。 It can be understood that the module division described above is a logical function division, and other division methods may be used in actual implementation. In addition, each functional module in each embodiment of the present application may be integrated in the same processing unit, or each module may exist physically alone, or two or more modules may be integrated in the same unit. The above-mentioned integrated modules can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
在另一實施方式中,所述電子設備100還可包括記憶體(圖未示),所述一個或多個模組還可存儲在記憶體中,並由所述處理器12執行。所述記憶體可以是電子設備100的內部記憶體,即內置於所述電子設備100的記憶
體。在其他實施例中,所述記憶體也可以是電子設備100的外部記憶體,即外接於所述電子設備100的記憶體。
In another embodiment, the
在一些實施例中,所述記憶體用於存儲程式碼和各種資料,例如,存儲安裝在所述電子設備100中的資料處理裝置10的程式碼,並在電子設備100的運行過程中實現高速、自動地完成程式或資料的存取。
In some embodiments, the memory is used to store program codes and various data, for example, to store the program codes of the
所述記憶體可以包括隨機存取記憶體,還可以包括非易失性記憶體,例如硬碟、記憶體、插接式硬碟、智慧存儲卡(Smart Media Card,SMC)、安全數位(Secure Digital,SD)卡、快閃記憶體卡(Flash Card)、至少一個磁碟記憶體件、快閃記憶體器件、或其他易失性固態記憶體件。 The memory may include random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, Smart Media Card (SMC), Secure Digital (Secure) Digital, SD) card, flash memory card (Flash Card), at least one disk memory device, flash memory device, or other volatile solid state memory device.
對於本領域技術人員而言,顯然本申請不限於上述示範性實施例的細節,而且在不背離本申請的精神或基本特徵的情況下,能夠以其他的具體形式實現本申請。因此,無論從哪一點來看,均應將本申請上述的實施例看作是示範性的,而且是非限制性的。 It will be apparent to those skilled in the art that the present application is not limited to the details of the above-described exemplary embodiments, but that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application. Therefore, the above-described embodiments of the present application should be regarded as exemplary, and not restrictive, from any point of view.
330:子資料 330: Sub data
340:雜湊函數 340: Hash function
350:第一雜湊值 350: first hash value
360:字串 360: string
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW109127995A TWI755029B (en) | 2020-08-17 | 2020-08-17 | Data processing method, device, electronic device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW109127995A TWI755029B (en) | 2020-08-17 | 2020-08-17 | Data processing method, device, electronic device and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TWI755029B true TWI755029B (en) | 2022-02-11 |
| TW202209134A TW202209134A (en) | 2022-03-01 |
Family
ID=81329486
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW109127995A TWI755029B (en) | 2020-08-17 | 2020-08-17 | Data processing method, device, electronic device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TWI755029B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| TWI806577B (en) | 2022-04-28 | 2023-06-21 | 瑞昱半導體股份有限公司 | Digital signature method and verification method for digital signature |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20120166401A1 (en) * | 2010-12-28 | 2012-06-28 | Microsoft Corporation | Using Index Partitioning and Reconciliation for Data Deduplication |
| EP2831767B1 (en) * | 2012-03-30 | 2019-12-25 | Khalifa University of Science and Technology | Method and system for processing data queries |
-
2020
- 2020-08-17 TW TW109127995A patent/TWI755029B/en active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20120166401A1 (en) * | 2010-12-28 | 2012-06-28 | Microsoft Corporation | Using Index Partitioning and Reconciliation for Data Deduplication |
| EP2831767B1 (en) * | 2012-03-30 | 2019-12-25 | Khalifa University of Science and Technology | Method and system for processing data queries |
Also Published As
| Publication number | Publication date |
|---|---|
| TW202209134A (en) | 2022-03-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9917689B2 (en) | Generating multiple secure hashes from a single data buffer | |
| US10990674B2 (en) | Malware clustering based on function call graph similarity | |
| US20200012792A1 (en) | System and method for statistical analysis of comparative entropy | |
| CN103646082B (en) | A kind of method and device of file verification | |
| US9270467B1 (en) | Systems and methods for trust propagation of signed files across devices | |
| US9202050B1 (en) | Systems and methods for detecting malicious files | |
| CN109993008A (en) | Methods and arrangements for implicit integrity | |
| US20200372183A1 (en) | Digitally Signing Software Packages With Hash Values | |
| US20210240829A1 (en) | Malware Clustering Based on Analysis of Execution-Behavior Reports | |
| CN112163412B (en) | Data verification method and device, electronic equipment and storage medium | |
| US11275835B2 (en) | Method of speeding up a full antivirus scan of files on a mobile device | |
| CN117278211B (en) | Domain name encryption method, decryption method and device based on content distribution network | |
| CN117311311A (en) | DCS controller credibility measurement method, system, electronic equipment and storage medium | |
| CN114329488B (en) | Methods, devices, electronic equipment, and storage media for verifying the trustworthiness of kernel functions. | |
| US10999057B2 (en) | Providing access to a hardware resource based on a canary value | |
| CN114780501A (en) | Data processing method, electronic device and computer program product | |
| CN114077490B (en) | Data processing method, device, electronic device and storage medium | |
| TWI755029B (en) | Data processing method, device, electronic device and storage medium | |
| JP2022522790A (en) | Methods and devices for tracking blockchain transactions | |
| CN110363000B (en) | Method, device, electronic equipment and storage medium for identifying malicious files | |
| US20230161877A1 (en) | Efficient integrity monitoring of processing operations with multiple memory arrays | |
| US20220191007A1 (en) | Distributed secure array using intra-dice communications to perform data attestation | |
| CN117499102A (en) | Method, device and equipment for quickly checking weak password | |
| CN115113815B (en) | Chip processing system, method, device and storage medium | |
| CN113591157B (en) | Access encrypted database detection method, terminal device and storage medium |