CN114143014B - Media file encryption method, decryption method, transmission method, device and system - Google Patents

Media file encryption method, decryption method, transmission method, device and system Download PDF

Info

Publication number
CN114143014B
CN114143014B CN202010808494.1A CN202010808494A CN114143014B CN 114143014 B CN114143014 B CN 114143014B CN 202010808494 A CN202010808494 A CN 202010808494A CN 114143014 B CN114143014 B CN 114143014B
Authority
CN
China
Prior art keywords
bits
value
encrypted
decryption
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010808494.1A
Other languages
Chinese (zh)
Other versions
CN114143014A (en
Inventor
董伯平
赵庆明
许学超
刘庆祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202010808494.1A priority Critical patent/CN114143014B/en
Publication of CN114143014A publication Critical patent/CN114143014A/en
Application granted granted Critical
Publication of CN114143014B publication Critical patent/CN114143014B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Storage Device Security (AREA)

Abstract

The invention discloses a media file encryption method, a media file decryption method, a media file transmission device and a media file transmission system, and relates to the field of encryption and decryption. The method comprises the following steps: splitting the codes of the source media file according to 2N bits to obtain a plurality of subcodes; taking the value corresponding to the last N bits of the sum of the values corresponding to the front and back N bits of each subcode as a first encryption value of the subcode and the absolute value of the difference of the values corresponding to the front and back N bits as a second encryption value of the subcode; setting a first identifier and a second identifier at a preset position of each subcode to obtain an encrypted value of each subcode, and combining the encrypted values of a plurality of subcodes to obtain the code of the encrypted media file. The risk of decryption caused by the leakage of the key of the media file is prevented, and meanwhile, the newly inserted identifier breaks the sequential organization structure of the original media file, so that the media file is difficult to crack.

Description

Media file encryption method, decryption method, transmission method, device and system
Technical Field
The disclosure relates to the field of encryption and decryption, and in particular relates to a media file encryption method, a media file decryption method, a media file transmission device and a media file transmission system.
Background
In the field of audio file transmission, when a client requests to a server to transmit an audio file, in order to protect the file from being stolen, the server generally needs to encrypt the transmitted file, and the client receives the audio file transmitted by the server, decrypts the audio file and then plays the audio file.
In the related art, a stream encryption algorithm with too single key and algorithm is generally adopted, or a full encryption algorithm with high operation complexity and a hierarchical encryption algorithm are adopted, and when the key is leaked, the audio file is at risk of being decrypted.
Disclosure of Invention
The technical problem to be solved by the present disclosure is to provide a media file encryption method, a decryption method, a transmission method, a device and a system, which can prevent the risk of decrypting a media file caused by key leakage.
According to an aspect of the present disclosure, a media file encryption method is provided, including: splitting the codes of the source media file according to 2N bits to obtain a plurality of subcodes, wherein N is a positive integer; for each sub-code, taking a value corresponding to the last N bits of the sum of the value corresponding to the first N bits and the value corresponding to the last N bits as a first encryption value of the sub-code, and taking an absolute value of a difference between the value corresponding to the first N bits and the value corresponding to the last N bits as a second encryption value of the sub-code; setting a first identifier and a second identifier at a preset position of each sub-code, wherein the first identifier is configured to identify whether the sum of values corresponding to the first N bits and values corresponding to the last N bits is larger than an overflow threshold value, and the second identifier is configured to identify whether the difference between the values corresponding to the first N bits and the values corresponding to the last N bits is larger than or equal to 0; determining the encryption value of each sub-code according to the first encryption value and the second encryption value of each sub-code, the first identifier and the second identifier; and combining the plurality of subcode encryption values to obtain a code of the encrypted media file.
In some embodiments, the overflow threshold is a maximum value corresponding to N bits.
In some embodiments, the first encryption value is an encryption value of the first N bits, wherein when the sum is greater than the overflow threshold, the difference between the sum of the values corresponding to the first N bits and the values corresponding to the last N bits and the overflow threshold is subtracted by 1 as the encryption value of the first N bits of the subcode; and when the sum is smaller than or equal to the overflow threshold value, taking the sum of the values corresponding to the first N bits and the values corresponding to the last N bits as the encrypted values of the first N bits of the subcode.
In some embodiments, the second encrypted value is an encrypted value of the last N bits, wherein when the difference is equal to or greater than 0, a difference between a value corresponding to the first N bits and a value corresponding to the last N bits is used as the encrypted value of the last N bits of the subcode; and when the difference is smaller than 0, taking a negative value of the difference between the value corresponding to the first N bits and the value corresponding to the last N bits as an encrypted value of the last N bits of the subcode.
In some embodiments, the first and second identifiers are each represented by a value of 1/2*N bits, with N being an even number.
According to another aspect of the present disclosure, there is also provided a media file decryption method, including: splitting the codes of the encrypted media file according to every first identifier and every second identifier to obtain a plurality of encrypted subcodes, wherein each encrypted subcode corresponds to 2N bits except the first identifier and the second identifier, N is a positive integer, the first identifier is configured to identify whether the sum of decryption values corresponding to the first N bits and decryption values corresponding to the last N bits of each subcode is greater than an overflow threshold, and the second identifier is configured to identify whether the difference between decryption values corresponding to the first N bits and decryption values corresponding to the last N bits of each subcode is greater than or equal to 0; removing the first identifier and the second identifier of each encrypted subcode to obtain a first encrypted value and a second encrypted value of each encrypted subcode; determining a decryption value of the first N bits and a decryption value of the last N bits of each sub-code according to the first identifier, the second identifier, the first encryption value and the second encryption value of each encrypted sub-code; determining the value of each subcode according to the decryption value of the first N bits and the decryption value of the last N bits of each subcode; and combining the plurality of subcode values to obtain a code of the source media file.
In some embodiments, the overflow threshold is a maximum value corresponding to N bits.
In some embodiments, the first encrypted value is an encrypted value of the first N bits and the second encrypted value is an encrypted value of the second N bits, wherein if a sum of the decrypted value corresponding to the first N bits identified as subcode and the decrypted value corresponding to the second N bits is greater than the overflow threshold, a sum of the decrypted value of the first N bits and the decrypted value of the second N bits of the encrypted subcode is equal to a sum +1 of the encrypted value of the first N bits and the overflow threshold; and if the sum of the decryption value corresponding to the first N bits of the first identifier sub-code and the decryption value corresponding to the last N bits is smaller than or equal to the overflow threshold value, the sum of the decryption value of the first N bits of the encrypted sub-code and the decryption value of the last N bits is equal to the encryption value of the first N bits.
In some embodiments, the first encrypted value is an encrypted value of the first N bits and the second encrypted value is an encrypted value of the second N bits, wherein if a difference between the decrypted value corresponding to the first N bits and the decrypted value corresponding to the second N bits of the sub-code is greater than or equal to 0, a difference between the decrypted value of the first N bits and the decrypted value of the second N bits of the encrypted sub-code is equal to the encrypted value of the second N bits; and if the difference between the decryption value corresponding to the first N bits of the second identifier sub-code and the decryption value corresponding to the last N bits is smaller than 0, the difference between the decryption value of the first N bits of the encrypted sub-code and the decryption value of the last N bits is equal to the negative value of the encryption value of the last N bits.
According to another aspect of the present disclosure, there is also provided a media file transmission method, including: the encryption device splits the codes of the source media file according to 2N bits to obtain a plurality of subcodes, wherein N is a positive integer; the encryption device uses, for each sub-code, a value corresponding to the last N bits of a sum of values corresponding to the first N bits and values corresponding to the last N bits as a first encryption value of the sub-code, and uses, as a second encryption value of the sub-code, an absolute value of a difference between the value corresponding to the first N bits and the value corresponding to the last N bits; the encryption device sets a first identifier and a second identifier at a preset position of each sub-code, wherein the first identifier is configured to identify whether the sum of values corresponding to the first N bits and values corresponding to the last N bits is larger than an overflow threshold value, and the second identifier is configured to identify whether the difference between the values corresponding to the first N bits and the values corresponding to the last N bits is larger than or equal to 0; the encryption device determines the encryption value of each subcode according to the first encryption value and the second encryption value of each subcode, the first identifier and the second identifier, combines the encryption values of the plurality of subcodes to obtain the codes of the encrypted media file, and sends the codes of the encrypted media file to the decryption device; the decryption device splits the codes of the encrypted media file according to every other first identifier and every other second identifier to obtain a plurality of encrypted subcodes, wherein each encrypted subcode is corresponding to 2N bits except the first identifier and the second identifier; the decryption device removes the first identifier and the second identifier of each encrypted subcode to obtain a first encrypted value and a second encrypted value of each encrypted subcode; the decryption device determines the decryption value of the first N bits and the decryption value of the last N bits of each sub-code according to the first identifier, the second identifier, the first encryption value and the second encryption value of each encrypted sub-code; the decryption device determines the value of each subcode according to the decryption value of the front N bits and the decryption value of the rear N bits of each subcode, and combines the values of the plurality of subcodes to obtain the code of the source media file.
According to another aspect of the present disclosure, there is also provided a media file encryption apparatus, including: a source file splitting unit configured to split the encoding of the source media file according to 2N bits to obtain a plurality of subcodes, where N is a positive integer; an encrypted value generation unit configured to, for each sub-code, take a value corresponding to the last N bits of a sum of values corresponding to the first N bits and values corresponding to the last N bits as a first encrypted value of the sub-code, and take an absolute value of a difference between the value corresponding to the first N bits and the value corresponding to the last N bits as a second encrypted value of the sub-code; an identification setting unit configured to set a first identification configured to identify whether a sum of values corresponding to the first N bits and values corresponding to the last N bits is greater than an overflow threshold value and a second identification configured to identify whether a difference between the values corresponding to the first N bits and the values corresponding to the last N bits is greater than or equal to 0 at a predetermined position of each sub-code; and an encrypted file generating unit configured to determine the encrypted value of each sub-code according to the first encrypted value and the second encrypted value of each sub-code, the first identifier and the second identifier, and combine the encrypted values of the plurality of sub-codes to obtain the code of the encrypted media file.
According to another aspect of the present disclosure, there is also provided a media file decrypting apparatus including: an encrypted file splitting unit configured to split the encoding of the encrypted media file according to every first identifier and every second identifier to obtain a plurality of encrypted subcodes, wherein each encrypted subcode corresponds to 2N bits except the first identifier and the second identifier, N is a positive integer, the first identifier is configured to identify whether the sum of decryption values corresponding to the first N bits and decryption values corresponding to the last N bits of each subcode is greater than an overflow threshold, and the second identifier is configured to identify whether the difference between decryption values corresponding to the first N bits and decryption values corresponding to the last N bits of each subcode is greater than or equal to 0; an identifier deleting unit configured to remove the first identifier and the second identifier of each encrypted subcode to obtain a first encrypted value and a second encrypted value of each encrypted subcode; a sub-code decryption unit configured to determine a decryption value of a first N bits and a decryption value of a second N bits of each sub-code based on the first and second identifications and the first and second encryption values of each encrypted sub-code, and to determine a value of each sub-code based on the decryption value of the first N bits and the decryption value of the second N bits of each sub-code; and a source file generation unit configured to combine the plurality of subcode values to obtain a code of the source media file.
According to another aspect of the present disclosure, there is also provided a media file encryption and decryption system, including: the media file encrypting device; and the media file decryption device.
According to another aspect of the present disclosure, there is also provided an electronic device including: a memory; and a processor coupled to the memory, the processor configured to perform a media file encryption method as described above, or a media file decryption method as described above, or a media file transmission method as described above, based on instructions stored in the memory.
According to another aspect of the disclosure, there is also provided a non-transitory computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement a media file encryption method as described above, or a media file decryption method as described above, or a media file transmission method as described above.
In the embodiment of the disclosure, the media file is encrypted by utilizing a mathematical formula and changing the structure of the media file, and the process has no key to participate in encryption, so that the risk of decrypting the media file caused by key leakage is prevented, and meanwhile, the newly inserted identifier breaks the sequential organization structure of the original media file, so that the media file is difficult to crack.
Other features of the present disclosure and its advantages will become apparent from the following detailed description of exemplary embodiments of the disclosure, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description, serve to explain the principles of the disclosure.
The disclosure will be understood more clearly from the following detailed description, with reference to the accompanying drawings,
Wherein:
fig. 1 is a flow diagram of some embodiments of a media file encryption method of the present disclosure.
Fig. 2 is a flow chart illustrating further embodiments of the media file encryption method of the present disclosure.
Fig. 3 is a flow diagram of some embodiments of a media file decryption method of the present disclosure.
Fig. 4 is a flow chart of some embodiments of a media file transfer method of the present disclosure.
Fig. 5 is a flow chart illustrating other embodiments of a media file transfer method of the present disclosure.
Fig. 6 is a schematic diagram of some embodiments of a media file encryption apparatus of the present disclosure.
Fig. 7 is a schematic structural diagram of some embodiments of a media file decryption device of the present disclosure.
Fig. 8 is a schematic diagram of the structure of some embodiments of a media file decryption system of the present disclosure.
Fig. 9 is a schematic structural diagram of some embodiments of the electronic device of the present disclosure.
Fig. 10 is a source media file encoding split diagram of the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless it is specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective parts shown in the drawings are not drawn in actual scale for convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail, but should be considered part of the specification where appropriate.
In all examples shown and discussed herein, any specific values should be construed as merely illustrative, and not a limitation. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further discussion thereof is necessary in subsequent figures.
For the purposes of promoting an understanding of the principles and advantages of the disclosure, reference will now be made to the embodiments illustrated in the drawings and specific language will be used to describe the same.
Fig. 1 is a flow diagram of some embodiments of a media file encryption method of the present disclosure.
In step 110, the encoding of the source media file is split according to 2N bits, where N is a positive integer, to obtain a plurality of subcodes.
In some embodiments, the source media file is an audio file.
In some embodiments, the value of N is determined according to the format of the source media file. For example, the audio file is in 8k16bit format, the encoding of the audio file may be split every 16 bits, i.e. 2 bytes, to obtain a plurality of subcodes, N being 8 bits, i.e. 1 byte.
In step 120, for each sub-code, a value corresponding to the last N bits of the sum of the values corresponding to the first N bits and the values corresponding to the last N bits is used as a first encrypted value for the sub-code, and an absolute value of a difference between the values corresponding to the first N bits and the values corresponding to the last N bits is used as a second encrypted value for the sub-code.
In some embodiments, the first encryption value is the first N bits of encryption value and the second encryption value is the last N bits of encryption value. It will be appreciated by those skilled in the art that the first encryption value may also be the last N bits of encryption value and the second encryption value the first N bits of encryption value, provided that the encryption device and the decryption device agree.
In some embodiments, when the sum of the values corresponding to the first N bits and the values corresponding to the last N bits is greater than the overflow threshold, the difference between the sum of the values corresponding to the first N bits and the values corresponding to the last N bits and the overflow threshold is subtracted by 1 as the encrypted value of the first N bits of the subcode.
In some embodiments, the overflow threshold is a binary maximum value for an N-bit. For example, N is 8, the overflow threshold is 11111111, represented by hexadecimal number as FF. If the value corresponding to the first 8 bits of a certain subcode is 00000001 and the value corresponding to the last 8 bits is 00000010, the sum of the values of the first 8 bits and the last 8 bits of the subcode is 00000011, and the sum is not greater than the overflow threshold 11111111. If the value corresponding to the first 8 bits of a certain subcode is 11111111 and the value corresponding to the last 8 bits is 00000001, the sum of the values of the first 8 bits and the last 8 bits of the subcode is 100000000, and the overflow threshold is exceeded.
For example, if the value corresponding to the first 8 bits of a certain subcode is 11111111 and the value corresponding to the second 8 bits is 00000001, the encrypted value of the first 8 bits of the subcode is 00000000.
In some embodiments, when the sum of the value corresponding to the first N bits and the value corresponding to the last N bits is equal to or less than the overflow threshold, the sum of the value corresponding to the first N bits and the value corresponding to the last N bits is used as the encrypted value of the first N bits of the subcode.
For example, if the value corresponding to the first 8 bits of a given subcode is 00000001 and the value corresponding to the second 8 bits is 00000010, the encrypted value of the first 8 bits of the subcode is 00000011.
In some embodiments, when the difference between the value corresponding to the first N bits and the value corresponding to the last N bits is equal to or greater than 0, the difference between the value corresponding to the first N bits and the value corresponding to the last N bits is used as the encrypted value of the last N bits of the sub-code.
For example, if the value corresponding to the first 8 bits of a given subcode is 00000010 and the value corresponding to the last 8 bits is 00000001, the encrypted value of the last 8 bits of the subcode is 00000001.
In some embodiments, when the difference between the value corresponding to the first N bits and the value corresponding to the last N bits is less than 0, a negative value of the difference between the value corresponding to the first N bits and the value corresponding to the last N bits is taken as the encrypted value of the last N bits of the subcode.
For example, if the value corresponding to the first 8 bits of a given subcode is 00000001 and the value corresponding to the second 8 bits is 00000010, the encrypted value of the second 8 bits of the subcode is 00000001.
In some embodiments, the formula is utilizedAnd calculating the encryption value of the first N bits of each subcode and the encryption value of the last N bits, wherein f (x, y) is the subcode, x is the value of the first N bits, and y is the value of the last N bits. When x+y is greater than the overflow threshold, the encryption value of the first N bits is z 1 minus 1, and when x+y is less than or equal to the overflow threshold, the encryption value of the first N bits is z 1. When x-y is greater than or equal to 0, the encryption value of the last N bits is z 2, and when x-y is less than 0, the encryption value of the last N bits is-z 2, namely the encryption value of the last N bits is |z 2 |.
In step 130, a first flag configured to identify whether a sum of values corresponding to the first N bits and values corresponding to the last N bits is greater than an overflow threshold and a second flag configured to identify whether a difference between the values corresponding to the first N bits and the values corresponding to the last N bits is greater than or equal to 0 are set at predetermined positions of each sub-code.
In some embodiments, the first and second identifiers are each represented by a value of 1/2*N bits, with N being an even number. For example, when the sum of the values of the first 8 bits and the last 8 bits of a certain subcode is greater than 11111111, the first flag is 0001; when the sum of the values of the front 8bit and the rear 8bit of the sub-code is less than or equal to 11111111, the first mark is 0000; when the difference value of the values of the front 8bit and the rear 8bit of the sub-code is more than or equal to 0, the first mark is 0000; when the difference between the values of the first 8 bits and the last 8 bits of the subcode is less than 0, then the first flag is 0001.
In step 140, the encrypted value of each sub-code is determined based on the first encrypted value and the second encrypted value of each sub-code and the first identifier and the second identifier.
In some embodiments, the encrypted value of each subcode is represented by a combination of the first encrypted value + the second encrypted value + the first identifier + the second identifier. For example, if the encryption value of the first 8 bits of a subcode is 00000001, the encryption value of the second 8 bits is 00000010, the first flag is 0000, and the second flag is 0001, the encryption value of the subcode is 000000010000001000000001.
In step 150, the plurality of subcode encryption values are combined to obtain a code of the encrypted media file.
In some embodiments, the plurality of subcode encryption values are combined in a code splitting order of the source media file to obtain a code of the encrypted media file.
In the above embodiment, the media file is encrypted by using a mathematical formula and changing the structure of the media file, and the process does not involve encryption of a key, so that the risk of decrypting the media file due to key leakage of the media file is prevented, and meanwhile, the newly inserted identifier breaks the sequential organization structure of the original media file, so that the media file is ensured to be difficult to crack.
Fig. 2 is a flow chart illustrating further embodiments of the media file encryption method of the present disclosure. In this embodiment, the media file is described by taking an audio file as an example. A first flag indicating that the sum of the values corresponding to the 1 st byte and the values corresponding to the 2 nd byte is greater than 11111111 is 0001, a first flag indicating that the sum of the values corresponding to the 1 st byte and the values corresponding to the 2 nd byte is less than or equal to 11111111 is 0000, a second flag indicating that the difference between the values corresponding to the 1 st byte and the values corresponding to the 2 nd byte is greater than or equal to 0 is 0000, and a second flag indicating that the difference between the values corresponding to the 1 st byte and the values corresponding to the 2 nd byte is less than 0 is 0001.
In step 210, the encoding of the source audio file is divided by a number of 2 bytes, resulting in a plurality of subcodes.
For example, as shown in fig. 10, the encoding of the source audio file is split from the file header, and every adjacent two bytes are split into one subcode. If the encoding of the source audio file is in binary representation, such as 11001100 01110100 11001010 01010101, then the encoding of the source audio file is split into 11001100 01110100 and 11001010 01010101.
In step 220, the sum of the value corresponding to the 1 st byte and the value corresponding to the 2 nd byte of each subcode and the difference of the value corresponding to the 1 st byte and the value corresponding to the 2 nd byte are calculated.
For example, if the value corresponding to the 1 st byte is x and the value corresponding to the 2 nd byte is y, x+y, and x-y are calculated.
In step 230, it is determined whether the sum of the value corresponding to the 1 st byte and the value corresponding to the 2 nd byte is greater than 11111111, if yes, step 231 is executed, otherwise step 232 is executed.
In step 231, the value of the last 8 bits of the sum of the value corresponding to the 1 st byte and the value corresponding to the 2 nd byte is taken as the encrypted value of the 1 st byte, and the first identifier 0001 is inserted after the 2 nd byte.
In step 232, the sum of the value corresponding to the 1 st byte and the value corresponding to the 2 nd byte is taken as the 1 st byte encrypted value, and the first flag 0000 is inserted after the 2 nd byte.
In step 240, it is determined whether the difference between the value corresponding to the 1 st byte and the value corresponding to the 2 nd byte is greater than or equal to 0, if so, step 241 is executed, otherwise, step 242 is executed.
In step 241, the difference between the value corresponding to the 1 st byte and the value corresponding to the 2 nd byte is taken as the encrypted value of the 2 nd byte, and the second identifier 0000 is inserted after the first identifier.
In step 242, a negative value of the difference between the value corresponding to the 1 st byte and the value corresponding to the 2 nd byte is taken as the encrypted value of the 2 nd byte, and a second identifier 0001 is inserted after the first identifier.
In some embodiments, the formula is utilizedWhen x+y is larger than 11111111, the encryption value of the 1 st byte is z 1 -11111111-00000001, and when x+y is smaller than 11111111, the encryption value of the 1 st byte is z 1. When x-y is equal to or greater than 00000000, the encryption value of the 2 nd byte is z 2, and when x-y is less than 00000000, the encryption value of the 2 nd byte is-z 2.
In some embodiments, the 1 st byte of the encrypted value and the 2 nd byte of the encrypted value are 10 digits.
In step 250, the combination of the 1 st byte of encrypted value, the 2 nd byte of encrypted value, the first identifier and the second identifier is used as the encrypted value for each subcode.
In step 260, the plurality of subcode encryption values are combined in the code splitting order of the source media file to obtain a code of the encrypted media file.
In the above embodiment, for the original audio file, from the file header, every two adjacent bytes are split into a pair of unknowns x and y, then, the encryption value of each byte is calculated, and the identifier is added after two bytes, so that the subsequent decryption device can decrypt according to the identifier, and the security of the audio file is ensured.
Fig. 3 is a flow diagram of some embodiments of a media file decryption method of the present disclosure.
In step 310, the encoding of the encrypted media file is split according to each first identifier and each second identifier to obtain a plurality of encrypted subcodes, where each encrypted subcode corresponds to 2N bits except for the first identifier and the second identifier, N is a positive integer, the first identifier is configured to identify whether a sum of values corresponding to the first N bits and values corresponding to the last N bits of each subcode is greater than an overflow threshold, and the second identifier is configured to identify whether a difference between values corresponding to the first N bits and values corresponding to the last N bits of each subcode is greater than or equal to 0.
In some embodiments, the media file is an audio file.
In some embodiments, the first encryption value is the first N bits of encryption value and the second encryption value is the last N bits of encryption value.
In some embodiments, the first and second identifiers are each represented by a value of 1/2*N bits, with N being an even number.
For example, if the audio file is split according to 2 bytes when encrypted, the first identifier and the second identifier occupy 1 byte in total, and then the encrypted audio file is divided according to every 3 bytes. The 3 rd byte corresponds to the first identifier and the second identifier, the first encrypted value is the encrypted value of the 1 st byte of the subcode, and the second encrypted value is the encrypted value of the 2 nd byte of the subcode.
At step 320, the first and second identifiers of each encrypted subcode are removed, resulting in a first and second encrypted value for each encrypted subcode.
In step 330, the values of the first N bits and the last N bits of each subcode are determined based on the first and second identifications and the first and second encrypted values of each subcode.
For example, if the sum of the value corresponding to the first N bits of the first identifier sub-code and the value corresponding to the last N bits is greater than the overflow threshold, the sum of the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the sum of the encrypted value of the first N bits and the overflow threshold +1; and if the sum of the value corresponding to the first N bits of the first identifier sub-code and the value corresponding to the last N bits is smaller than or equal to an overflow threshold value, the sum of the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the encrypted value of the first N bits.
For another example, if the second flag is that the difference between the value corresponding to the first N bits of the sub-code and the value corresponding to the last N bits is greater than or equal to 0, the difference between the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the encrypted value of the last N bits; and if the difference between the value corresponding to the first N bits of the second identifier sub-code and the value corresponding to the last N bits is less than 0, the difference between the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the negative value of the encrypted value of the last N bits.
I.e. according to the formulaSolving x and y, wherein x is an encryption value of the first N bits, y is an encryption value of the last N bits, determining, by the decryption device, whether the first encryption value is z 1 or a difference value between the first encryption value and an overflow threshold needs to be subtracted by 1 on the basis of z 1 according to the first identifier and the second identifier, and determining whether the second encryption value is z 2 or-z 2.
In step 340, the value of each subcode is determined from the values of the first N bits and the values of the last N bits of each subcode.
In some embodiments, the value of each subcode is a combination of the values of the first N bits and the values of the last N bits.
In step 350, the multiple subcode values are combined to obtain the encoding of the source media file.
In some embodiments, the plurality of subcode values are combined in a code splitting order of the encrypted media file to obtain the code of the source media file.
In the above embodiment, the decryption device calculates the actual value of each subcode according to the first identifier and the second identifier, so as to obtain the code of the source media file.
Fig. 4 is a flow chart illustrating further embodiments of a media file decryption method of the present disclosure. In this embodiment, the media file is described by taking an audio file as an example. A first flag indicating that the sum of the values corresponding to the 1 st byte and the values corresponding to the 2 nd byte is greater than 11111111 is 0001, a first flag indicating that the sum of the values corresponding to the 1 st byte and the values corresponding to the 2 nd byte is less than or equal to 11111111 is 0000, a second flag indicating that the difference between the values corresponding to the 1 st byte and the values corresponding to the 2 nd byte is greater than or equal to 0 is 0000, and a second flag indicating that the difference between the values corresponding to the 1 st byte and the values corresponding to the 2 nd byte is less than 0 is 0001.
In step 410, the encoding of the encrypted audio file is divided by 3 bytes to obtain a plurality of encrypted subcodes.
In step 420, for each encrypted subcode, it is determined whether the first identifier is 0000, if yes, step 421 is performed, otherwise step 422 is performed.
In step 421, the sum of the decrypted value of the 1 st byte and the decrypted value of the 2 nd byte of the formula is established as the encrypted value of the 1 st byte.
In step 422, the sum of the decrypted value of byte 1 and the decrypted value of byte 2 of the formula is established as the encrypted value of byte 1 +11111111+00000001.
In step 430, for each encrypted subcode, it is determined whether the second identifier is 0000, if yes, step 431 is performed, otherwise step 432 is performed.
In step 431, the difference between the decrypted value of the 1 st byte and the decrypted value of the 2 nd byte of the formula is established as the encrypted value of the 2 nd byte.
In step 432, the difference between the decrypted value of byte 1 and the decrypted value of byte 2 is established as the negative of the encrypted value of byte 2.
In step 440, the formula is solved to obtain a decrypted value of byte 1 and a decrypted value of byte 2.
In step 450, the combination of the decrypted value of byte 1 and the decrypted value of byte 2 is used as the decrypted value for each subcode.
In step 460, the decrypted values of the plurality of subcodes are combined in the code splitting order of the encrypted audio file to obtain the code of the source audio file.
In the above embodiment, when the encrypted audio file is decrypted, the encrypted audio file is divided into a group of three bytes, and a solving formula is established according to the first identifier and the second identifier, so as to obtain a decryption value of the 1 st byte and a decryption value of the 2 nd byte of each subcode, and further obtain the encoding of the source audio file. The decryption process does not need to use a secret key, so that the risk of obtaining the audio file caused by secret key leakage and decrypting the audio file is reduced.
Fig. 5 is a flow chart of some embodiments of a media file transfer method of the present disclosure.
In step 510, the encryption device splits the encoding of the source media file by 2N bits to obtain a plurality of subcodes, where N is a positive integer.
In step 520, the encryption device uses, for each sub-code, a value corresponding to the last N bits of the sum of the values corresponding to the first N bits and the values corresponding to the last N bits as a first encrypted value of the sub-code, and uses, as a second encrypted value of the sub-code, an absolute value of a difference between the values corresponding to the first N bits and the values corresponding to the last N bits.
In some embodiments, the first encryption value is the encryption value corresponding to the first N bits, and the second encryption value is the encryption value corresponding to the preceding and following bits.
In step 530, the encryption device sets a first flag configured to flag whether a sum of values corresponding to the first N bits and values corresponding to the last N bits is greater than an overflow threshold and a second flag configured to flag whether a difference between the values corresponding to the first N bits and the values corresponding to the last N bits is greater than or equal to 0 at a predetermined position of each sub-code.
In step 540, the encryption device determines the encryption value of each sub-code according to the first encryption value and the second encryption value of each sub-code, the first identifier and the second identifier, combines the encryption values of the plurality of sub-codes to obtain the code of the encrypted media file, and sends the code of the encrypted media file to the decryption device.
In some embodiments, the first N bits of the first sub-code are sequentially combined with the first N bits of the first sub-code, the second N bits of the first sub-code are sequentially combined with the first identifier, and then the first sub-code is combined with the second sub-code to obtain the encrypted media file.
In step 550, the decryption device splits the encoding of the encrypted media file according to every second identifier and every first identifier to obtain a plurality of encrypted subcodes, where each encrypted subcode corresponds to 2N bits except for the first identifier and the second identifier.
In step 560, the decryption means removes the first and second identifications of each encrypted subcode to obtain the first and second encrypted values of each encrypted subcode.
In step 570, the decryption means determines the value of the first N bits and the value of the last N bits of each sub-code based on the first and second identifications and the first and second encrypted values of each encrypted sub-code.
In some embodiments, if the sum of the value corresponding to the first N bits of the first identifier sub-code and the value corresponding to the last N bits is greater than the overflow threshold, the sum of the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the sum of the encrypted value of the first N bits and the overflow threshold +1; and if the sum of the value corresponding to the first N bits of the first identifier sub-code and the value corresponding to the last N bits is smaller than or equal to an overflow threshold value, the sum of the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the encrypted value of the first N bits.
In some embodiments, if the second identifier is that the difference between the decryption value corresponding to the first N bits and the decryption value corresponding to the last N bits of the subcode is greater than or equal to 0, the difference between the decryption value of the first N bits and the decryption value of the last N bits of the subcode is equal to the encryption value of the last N bits; and if the difference between the decryption value corresponding to the first N bits of the second identifier sub-code and the decryption value corresponding to the last N bits is smaller than 0, the difference between the decryption value of the first N bits of the encrypted sub-code and the decryption value of the last N bits is equal to the negative value of the encryption value of the last N bits.
In step 580, the decryption device determines the value of each subcode based on the encrypted value of the first N bits and the decrypted value of the last N bits of each subcode, and combines the values of the plurality of subcodes to obtain the code of the source media file.
In the above embodiment, compared with a simple stream encryption algorithm or a multi-key encryption algorithm, the method uses a mathematical formula and a new flag byte mode, no key participates in encryption in the whole process, the risk of decrypting the media file caused by key leakage is prevented, and meanwhile, the new inserted flag byte breaks the sequential organization structure of the original media file, so that the media file is ensured to be difficult to crack.
Fig. 6 is a schematic diagram of some embodiments of a media file encryption apparatus of the present disclosure. The encryption apparatus includes a source file splitting unit 610, an encrypted value generating unit 620, an identification setting unit 630, and an encrypted file generating unit 640.
The source file splitting unit 610 is configured to split the encoding of the source media file by 2N bits to obtain a plurality of subcodes, where N is a positive integer.
In some embodiments, the source media file is an audio file.
In some embodiments, the value of N is determined according to the format of the source media file. For example, the audio file is in 8k16bit format, the encoding of the audio file may be split every 16 bits, i.e. 2 bytes, to obtain a plurality of subcodes, N being 8 bits, i.e. 1 byte.
The encrypted-value generating unit 620 is configured to, for each sub-code, take, as a first encrypted value of the sub-code, a value corresponding to the last N bits of a sum of values corresponding to the first N bits and values corresponding to the last N bits, and take, as a second encrypted value of the sub-code, an absolute value of a difference between the values corresponding to the first N bits and the values corresponding to the last N bits.
In some embodiments, the first encryption value is the first N bits of encryption value and the second encryption value is the last N bits of encryption value. It will be appreciated by those skilled in the art that the first encryption value may also be the last N bits of encryption value and the second encryption value the first N bits of encryption value, provided that the encryption device and the decryption device agree.
In some embodiments, when the sum of the values corresponding to the first N bits and the values corresponding to the last N bits is greater than the overflow threshold, the difference between the sum of the values corresponding to the first N bits and the values corresponding to the last N bits and the overflow threshold is subtracted by 1 as the encrypted value of the first N bits of the subcode.
In some embodiments, the overflow threshold is a binary maximum value for an N-bit.
In some embodiments, when the sum of the value corresponding to the first N bits and the value corresponding to the last N bits is equal to or less than the overflow threshold, the sum of the value corresponding to the first N bits and the value corresponding to the last N bits is used as the encrypted value of the first N bits of the subcode.
In some embodiments, when the difference between the value corresponding to the first N bits and the value corresponding to the last N bits is equal to or greater than 0, the difference between the value corresponding to the first N bits and the value corresponding to the last N bits is used as the encrypted value of the last N bits of the sub-code.
In some embodiments, when the difference between the value corresponding to the first N bits and the value corresponding to the last N bits is less than 0, a negative value of the difference between the value corresponding to the first N bits and the value corresponding to the last N bits is taken as the encrypted value of the last N bits of the subcode.
The flag setting unit 630 is configured to set a first flag configured to flag whether or not the sum of values corresponding to the first N bits and values corresponding to the last N bits is greater than an overflow threshold value and a second flag configured to flag whether or not the difference between the values corresponding to the first N bits and the values corresponding to the last N bits is greater than or equal to 0 at a predetermined position of each sub-code.
In some embodiments, the first and second identifiers are each represented by a value of 1/2*N bits, with N being an even number.
The encrypted-file generating unit 640 is configured to determine an encrypted value of each sub-code according to the first encrypted value and the second encrypted value of each sub-code, and the first identifier and the second identifier, and combine the encrypted values of the plurality of sub-codes to obtain the code of the encrypted media file.
In the above embodiment, the media file is encrypted by using a mathematical formula and changing the structure of the media file, and the process does not involve encryption of a key, so that the risk of decrypting the media file obtained due to key leakage is prevented, and meanwhile, the newly inserted identifier breaks the sequential organization structure of the original media file, so that the media file is difficult to crack.
Fig. 7 is a schematic structural diagram of some embodiments of a media file decryption device of the present disclosure. The decryption apparatus includes an encrypted file splitting unit 710, an identification deleting unit 720, a subcode decrypting unit 730, and a source file generating unit 740.
The encrypted file splitting unit 710 is configured to split the encoding of the encrypted media file according to every first identifier and every second identifier to obtain a plurality of encrypted subcodes, where each encrypted subcode corresponds to 2N bits except for the first identifier and the second identifier, N is a positive integer, the first identifier is configured to identify whether a sum of a decryption value corresponding to a first N bits and a decryption value corresponding to a second N bits of each subcode is greater than an overflow threshold, and the second identifier is configured to identify whether a difference between the decryption value corresponding to the first N bits and the decryption value corresponding to the second N bits of each subcode is greater than or equal to 0.
In some embodiments, the first encryption value is the first N bits of encryption value and the second encryption value is the last N bits of encryption value.
In some embodiments, the first and second identifiers are each represented by a value of 1/2*N bits, with N being an even number.
The identifier deletion unit 720 is configured to remove the first identifier and the second identifier of each encrypted subcode, resulting in a first encrypted value and a second encrypted value of each encrypted subcode.
The subcode decryption unit 730 is configured to determine a decryption value of the first N bits and a decryption value of the last N bits of each subcode based on the first and second identifications and the first and second encryption values of each encrypted subcode, and to determine a value of each subcode based on the decryption value of the first N bits and the decryption value of the last N bits of each subcode.
For example, if the sum of the value corresponding to the first N bits of the first identifier sub-code and the value corresponding to the last N bits is greater than the overflow threshold, the sum of the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the sum of the encrypted value of the first N bits and the overflow threshold +1; and if the sum of the value corresponding to the first N bits of the first identifier sub-code and the value corresponding to the last N bits is smaller than or equal to an overflow threshold value, the sum of the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the encrypted value of the first N bits.
For another example, if the second flag is that the difference between the value corresponding to the first N bits of the sub-code and the value corresponding to the last N bits is greater than or equal to 0, the difference between the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the encrypted value of the last N bits; and if the difference between the value corresponding to the first N bits of the second identifier sub-code and the value corresponding to the last N bits is less than 0, the difference between the decrypted value of the first N bits of the encrypted sub-code and the decrypted value of the last N bits is equal to the negative value of the encrypted value of the last N bits.
In some embodiments, the value of each subcode is a combination of the values of the first N bits and the values of the last N bits.
The source file generation unit 740 is configured to combine the plurality of sub-encoded values to obtain an encoding of the source media file.
In the above embodiment, the decryption device calculates the actual value of each subcode according to the first identifier and the second identifier, so as to obtain the code of the source media file.
Fig. 8 is a schematic structural diagram of some embodiments of a media file encryption and decryption system of the present disclosure. The encryption and decryption system includes a media file encryption device 810 and a media file decryption device 820, wherein the media file encryption device 810 and the media file decryption device 820 have been described in detail in the above embodiments. The media file encryption device 810 and the media file decryption device 820 may be two servers.
In some embodiments, the encryption and decryption system is applied to an intelligent voice navigation system, and through practical detection, the implementation is simple and efficient, and has wider adaptability.
Fig. 9 is a schematic structural diagram of some embodiments of the electronic device of the present disclosure. The electronic device includes a memory 910 and a processor 920. Wherein: memory 910 may be a magnetic disk, flash memory, or any other non-volatile storage medium. The electronic device may be located in the media file encryption device or in the media file decryption device. The electronic device is located in the media file encrypting apparatus, the memory 910 is configured to store the instructions in the embodiments corresponding to fig. 1,2, and 5, and when the electronic device is located in the media file decrypting apparatus, the memory 910 is configured to store the instructions in the embodiments corresponding to fig. 3, 4, and 5. Processor 920 is coupled to memory 910 and may be implemented as one or more integrated circuits, such as a microprocessor or microcontroller. The processor 920 is configured to execute instructions stored in the memory.
In some embodiments, processor 920 is coupled to memory 910 through BUS 930. The electronic device 900 may also be coupled to external storage system 950 via storage interface 940 for invoking external data, and to a network or another computer system (not shown) via network interface 960. And will not be described in detail herein.
In this embodiment, the security of the media file is improved.
In other embodiments, a computer readable storage medium has stored thereon computer program instructions which, when executed by a processor, implement the steps of the method of the corresponding embodiments of fig. 1-5. It will be apparent to those skilled in the art that embodiments of the present disclosure may be provided as a method, apparatus, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Thus far, the present disclosure has been described in detail. In order to avoid obscuring the concepts of the present disclosure, some details known in the art are not described. How to implement the solutions disclosed herein will be fully apparent to those skilled in the art from the above description.
Although some specific embodiments of the present disclosure have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present disclosure. It will be appreciated by those skilled in the art that modifications may be made to the above embodiments without departing from the scope and spirit of the disclosure. The scope of the present disclosure is defined by the appended claims.

Claims (15)

1. A method of encrypting a media file, comprising:
splitting the codes of the source media file according to 2N bits to obtain a plurality of subcodes, wherein N is a positive integer;
For each sub-code, taking a value corresponding to the last N bits of the sum of the value corresponding to the first N bits and the value corresponding to the last N bits as a first encryption value of the sub-code, and taking an absolute value of a difference between the value corresponding to the first N bits and the value corresponding to the last N bits as a second encryption value of the sub-code;
setting a first identifier and a second identifier at a preset position of each sub-code, wherein the first identifier is configured to identify whether the sum of values corresponding to the first N bits and values corresponding to the last N bits is larger than an overflow threshold value, and the second identifier is configured to identify whether the difference between the values corresponding to the first N bits and the values corresponding to the last N bits is larger than or equal to 0;
Determining the encryption value of each sub-code according to the first encryption value and the second encryption value of each sub-code, the first identifier and the second identifier; and
And combining the plurality of sub-coded encryption values to obtain the codes of the encrypted media files.
2. The media file encryption method of claim 1, wherein,
The overflow threshold is a maximum value corresponding to N bits.
3. The media file encryption method of claim 2, wherein said first encryption value is a top N bit encryption value, wherein,
Subtracting 1 from the difference between the sum of the values corresponding to the first N bits and the values corresponding to the last N bits and the overflow threshold when the sum is greater than the overflow threshold, and using the result as the encrypted value of the first N bits of the subcode; and
And when the sum is smaller than or equal to the overflow threshold value, taking the sum of the values corresponding to the first N bits and the values corresponding to the last N bits as the encrypted value of the first N bits of the subcode.
4. The media file encryption method of claim 1, wherein said second encryption value is a last N bits encryption value, wherein,
When the difference is greater than or equal to 0, taking the difference between the value corresponding to the first N bits and the value corresponding to the last N bits as an encrypted value of the last N bits of the subcode; and
And when the difference is smaller than 0, taking a negative value of the difference between the value corresponding to the first N bits and the value corresponding to the last N bits as an encrypted value of the last N bits of the subcode.
5. The media file encryption method according to any one of claims 1 to 4, wherein,
The first identifier and the second identifier are respectively represented by a numerical value of 1/2*N bits, and N is an even number.
6. A media file decryption method comprising:
Splitting the encoding of the encrypted media file according to a first identifier and a second identifier to obtain a plurality of encrypted subcodes, wherein each encrypted subcode is corresponding to 2N bits except the first identifier and the second identifier, N is a positive integer, the first identifier is configured to identify whether the sum of decryption values corresponding to the first N bits and decryption values corresponding to the last N bits of each subcode is greater than an overflow threshold, and the second identifier is configured to identify whether the difference between decryption values corresponding to the first N bits and decryption values corresponding to the last N bits of each subcode is greater than or equal to 0;
Removing the first identifier and the second identifier of each encrypted subcode to obtain a first encrypted value and a second encrypted value of each encrypted subcode;
Determining a decryption value of the first N bits and a decryption value of the last N bits of each sub-code according to the first identifier, the second identifier, the first encryption value and the second encryption value of each encrypted sub-code;
determining the value of each sub-code according to the decryption value of the front N bits and the decryption value of the rear N bits of each sub-code; and
And combining the plurality of sub-coded values to obtain the codes of the source media file.
7. The media file decryption method of claim 6, wherein,
The overflow threshold is a maximum value corresponding to N bits.
8. The media file decryption method of claim 7, wherein the first encrypted value is an encrypted value of the first N bits and the second encrypted value is an encrypted value of the last N bits, wherein,
If the sum of the decryption values corresponding to the first N bits of the sub-code and the decryption values corresponding to the last N bits of the sub-code is larger than the overflow threshold, the sum of the decryption values of the first N bits of the sub-code and the decryption values of the last N bits of the sub-code is equal to the sum +1 of the encryption values of the first N bits and the overflow threshold; and
And if the sum of the decryption value corresponding to the first N bits of the sub-code and the decryption value corresponding to the last N bits of the sub-code is smaller than or equal to the overflow threshold value, the sum of the decryption value of the first N bits of the sub-code and the decryption value of the last N bits of the sub-code is equal to the encryption value of the first N bits.
9. The media file decryption method according to any one of claims 6 to 8, wherein the first encryption value is an encryption value of the first N bits and the second encryption value is an encryption value of the last N bits, wherein,
If the second identifier is that the difference between the decryption value corresponding to the first N bits of the subcode and the decryption value corresponding to the last N bits is greater than or equal to 0, the difference between the decryption value of the first N bits of the subcode and the decryption value of the last N bits of the subcode is equal to the encryption value of the last N bits; and
And if the difference between the decryption value corresponding to the first N bits of the sub-code and the decryption value corresponding to the last N bits of the sub-code is smaller than 0, the difference between the decryption value of the first N bits of the encrypted sub-code and the decryption value of the last N bits of the encrypted sub-code is equal to the negative value of the encryption value of the last N bits.
10. A method of media file transfer, comprising:
The encryption device splits the codes of the source media file according to 2N bits to obtain a plurality of subcodes, wherein N is a positive integer;
The encryption device uses, for each sub-code, a value corresponding to the last N bits of a sum of values corresponding to the first N bits and values corresponding to the last N bits as a first encrypted value of the sub-code, and uses, as a second encrypted value of the sub-code, an absolute value of a difference between the value corresponding to the first N bits and the value corresponding to the last N bits;
The encryption device sets a first identifier and a second identifier at a preset position of each sub-code, wherein the first identifier is configured to identify whether the sum of values corresponding to the first N bits and values corresponding to the last N bits is larger than an overflow threshold value, and the second identifier is configured to identify whether the difference between the values corresponding to the first N bits and the values corresponding to the last N bits is larger than or equal to 0;
The encryption device determines the encryption value of each subcode according to the first encryption value and the second encryption value of each subcode, the first identifier and the second identifier, combines the encryption values of a plurality of subcodes to obtain the codes of the encrypted media file, and sends the codes of the encrypted media file to the decryption device; and
The decryption device splits the codes of the encrypted media file according to every other first identifier and every other second identifier to obtain a plurality of encrypted subcodes, wherein each encrypted subcode is corresponding to 2N bits except the first identifier and the second identifier;
The decryption device removes the first identifier and the second identifier of each encrypted subcode to obtain a first encrypted value and a second encrypted value of each encrypted subcode;
The decryption device determines the decryption value of the front N bits and the decryption value of the rear N bits of each sub-code according to the first identifier, the second identifier, the first encryption value and the second encryption value of each encrypted sub-code;
The decryption device determines the value of each subcode according to the decryption value of the front N bits and the decryption value of the rear N bits of each subcode, and combines a plurality of the subcode values to obtain the code of the source media file.
11. A media file encryption apparatus comprising:
A source file splitting unit configured to split the encoding of the source media file according to 2N bits to obtain a plurality of subcodes, where N is a positive integer;
An encrypted value generation unit configured to, for each of the subcodes, take a value corresponding to a last N bits of a sum of values corresponding to a first N bits and values corresponding to a last N bits as a first encrypted value of the subcode, and take an absolute value of a difference between the value corresponding to the first N bits and the value corresponding to the last N bits as a second encrypted value of the subcode;
An identification setting unit configured to set a first identification configured to identify whether a sum of values corresponding to first N bits and values corresponding to last N bits is greater than an overflow threshold value and a second identification configured to identify whether a difference between the values corresponding to the first N bits and the values corresponding to the last N bits is greater than or equal to 0 at a predetermined position of each of the sub-codes; and
And the encrypted file generating unit is configured to determine the encrypted value of each subcode according to the first encrypted value and the second encrypted value of each subcode, the first identifier and the second identifier, and combine the encrypted values of a plurality of subcodes to obtain the code of the encrypted media file.
12. A media file decryption apparatus comprising:
an encrypted file splitting unit configured to split an encoding of an encrypted media file according to a first identifier and a second identifier to obtain a plurality of encrypted subcodes, wherein each encrypted subcode corresponds to 2N bits except for the first identifier and the second identifier, N is a positive integer, the first identifier is configured to identify whether a sum of a decryption value corresponding to a first N bits and a decryption value corresponding to a second N bits of each subcode is greater than an overflow threshold, and the second identifier is configured to identify whether a difference between the decryption value corresponding to the first N bits and the decryption value corresponding to the second N bits is greater than or equal to 0;
an identifier deleting unit configured to remove the first identifier and the second identifier of each encrypted subcode to obtain a first encrypted value and a second encrypted value of each encrypted subcode;
A sub-code decryption unit configured to determine a decryption value of a front N bits and a decryption value of a rear N bits of each of the sub-codes based on the first and second identifications and the first and second encryption values of each of the encrypted sub-codes, and to determine a value of each of the sub-codes based on the decryption value of the front N bits and the decryption value of the rear N bits of each of the sub-codes; and
And a source file generating unit configured to combine the plurality of sub-encoded values to obtain an encoding of the source media file.
13. A media file encryption and decryption system comprising:
the media file encryption apparatus of claim 11; and
The media file decryption device of claim 12.
14. An electronic device, comprising:
A memory; and
A processor coupled to the memory, the processor configured to perform the media file encryption method of any one of claims 1 to 5, or the media file decryption method of any one of claims 6 to 9, or the media file transmission method of claim 10, based on instructions stored in the memory.
15. A non-transitory computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the media file encryption method of any one of claims 1 to 5, or the media file decryption method of any one of claims 6 to 9, or the media file transmission method of claim 10.
CN202010808494.1A 2020-08-12 2020-08-12 Media file encryption method, decryption method, transmission method, device and system Active CN114143014B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010808494.1A CN114143014B (en) 2020-08-12 2020-08-12 Media file encryption method, decryption method, transmission method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010808494.1A CN114143014B (en) 2020-08-12 2020-08-12 Media file encryption method, decryption method, transmission method, device and system

Publications (2)

Publication Number Publication Date
CN114143014A CN114143014A (en) 2022-03-04
CN114143014B true CN114143014B (en) 2024-05-14

Family

ID=80438022

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010808494.1A Active CN114143014B (en) 2020-08-12 2020-08-12 Media file encryption method, decryption method, transmission method, device and system

Country Status (1)

Country Link
CN (1) CN114143014B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008107656A (en) * 2006-10-26 2008-05-08 Canon Inc Encrypting apparatus and authentication apparatus
CN103684761A (en) * 2013-12-25 2014-03-26 广西宝恒电子科技有限公司 Coding and decoding method
CN103853985A (en) * 2012-12-05 2014-06-11 中国移动通信集团黑龙江有限公司 Data encryption method, decryption method and decryption device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10201449C1 (en) * 2002-01-16 2003-08-14 Infineon Technologies Ag Arithmetic unit, method for performing an operation with an encrypted operand, carry select adder and cryptography processor

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008107656A (en) * 2006-10-26 2008-05-08 Canon Inc Encrypting apparatus and authentication apparatus
CN103853985A (en) * 2012-12-05 2014-06-11 中国移动通信集团黑龙江有限公司 Data encryption method, decryption method and decryption device
CN103684761A (en) * 2013-12-25 2014-03-26 广西宝恒电子科技有限公司 Coding and decoding method

Also Published As

Publication number Publication date
CN114143014A (en) 2022-03-04

Similar Documents

Publication Publication Date Title
US11184164B2 (en) Secure crypto system attributes
US9537657B1 (en) Multipart authenticated encryption
WO2015156786A1 (en) Redactable document signatures
CN112464258B (en) Data encryption and decryption methods, devices, equipment and storage medium
CN107534549B (en) Readable storage medium, method and system for encrypting data stream block
CN114840867B (en) Data query method, device and system based on exchangeable encrypted data confusion
WO2021129470A1 (en) Polynomial-based system and method for fully homomorphic encryption of binary data
CN115098549A (en) Fair data hiding trace query method, device, equipment and storage medium
CN111404892B (en) Data supervision method and device and server
US20240178999A1 (en) Method for data encryption, terminal device and non-transitory computer-readable storage medium
US11354427B2 (en) Encrypting/decrypting method for multi-digit number and encrypting/decrypting server
CN113326518A (en) Data processing method and device
CN114143014B (en) Media file encryption method, decryption method, transmission method, device and system
CN109951275B (en) Key generation method and device, computer equipment and storage medium
US20220345292A1 (en) Method and device for encryption of video stream, communication equipment, and storage medium
CN110943837B (en) User password encryption method based on improved MD5 encryption algorithm
CN115935299A (en) Authorization control method, device, computer equipment and storage medium
CN114765529A (en) Homomorphic encryption storage method and device for distributed data, electronic equipment and computer readable medium
CN116484443B (en) Trusted security storage method and device based on hong Monte-go system
CN114124413A (en) Media file encryption method, decryption method, transmission method and device
CN117221878B (en) Information security control method and device based on wireless network equipment
CN110138555B (en) Encryption and decryption method for FBX format three-dimensional model
CN118200049B (en) Encryption method, encryption device, equipment and medium for financial data
CN111355577B (en) Network data safety transmission system and method
CN117235754A (en) Data encryption and decryption method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant