CN114329555A - Video file encryption processing method and device, storage medium and equipment - Google Patents
Video file encryption processing method and device, storage medium and equipment Download PDFInfo
- Publication number
- CN114329555A CN114329555A CN202111631083.0A CN202111631083A CN114329555A CN 114329555 A CN114329555 A CN 114329555A CN 202111631083 A CN202111631083 A CN 202111631083A CN 114329555 A CN114329555 A CN 114329555A
- Authority
- CN
- China
- Prior art keywords
- sub
- video
- video file
- tree
- encrypted
- 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.)
- Pending
Links
Images
Landscapes
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The invention discloses a video file encryption processing method, a video file encryption processing device, a storage medium and video file encryption processing equipment. Wherein, the method comprises the following steps: acquiring an original video file and the video byte number of the original video file; according to the number of bytes of the video, a binary tree algorithm is adopted to carry out segmentation processing on the original video file to obtain a plurality of sub video files; respectively encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files; and splicing the plurality of encrypted sub-video files to obtain the encrypted video files. The invention solves the technical problems that the video file encryption processing method in the prior art is too single and is easy to crack.
Description
Technical Field
The invention relates to the technical field of information security, in particular to a video file encryption processing method, a video file encryption processing device, a storage medium and video file encryption equipment.
Background
The method for recording the droplets in life by recording the videos is mainstream in the life of users, but the related technology in the aspect of video protection is very deficient, so that each user has the risk of stealing the private videos of the users by utilizing the vulnerability of lawless persons.
In the prior art, the video file protection mode is different, and various different means are mostly adopted to obtain a secret key from the video file, and then the video file is encrypted through the secret key, for example: directly encrypting data of preset bytes or fields of key frames in a video file to obtain a corresponding secret key; the video file is encrypted by a key. Once the secret key is illegally obtained, the video file is very likely to be stolen, and the existing encryption method is too single and is easy to be violently cracked, so that the video cannot be effectively protected.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a video file encryption processing method, a video file encryption processing device, a storage medium and video file encryption processing equipment, which are used for at least solving the technical problems that the video file encryption processing method in the prior art is too single and is easy to crack.
According to an aspect of the embodiments of the present invention, there is provided a video file encryption processing method, including: acquiring an original video file and the video byte number of the original video file; according to the number of bytes of the video, a binary tree algorithm is adopted to carry out segmentation processing on the original video file to obtain a plurality of sub video files; respectively encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files; and splicing the plurality of encrypted sub-video files to obtain the encrypted video files.
Optionally, the segmenting the original video file by using a binary tree algorithm according to the number of bytes of the video to obtain a plurality of sub-video files includes: defining the tail number of the video byte number as the initial tree height value of the binary tree model, wherein if the tail number of the video byte number is 0, the initial tree height value is determined to be 10; if the initial tree height value is divided by 2 to obtain an integer, adding 1 to the initial tree height value to obtain a current tree height value; calculating according to the height value of the current tree to obtain the number of video segmentation nodes; and dividing the original video file into a plurality of sub video files according to a preset division ratio and the number of the video division nodes.
Optionally, the segmenting the original video file into a plurality of sub-video files according to a predetermined segmentation ratio and the number of the video segmentation nodes includes: and according to the preset segmentation proportion and the number of the video segmentation nodes, respectively generating a left sub-tree and a right sub-tree of the binary tree model from a plurality of the sub-video files obtained by segmenting the original video file, wherein the number of the sub-videos at the bottommost layers of the left sub-tree and the right sub-tree is the same as the number of the nodes.
Optionally, the encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files respectively includes: acquiring the number of bytes of sub-video and the number of times of dividing the sub-video file in the left sub-tree; calculating to obtain a first secret key parameter corresponding to the left sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file; and multiple threads encrypt each sub video file in the left sub-tree by using the first secret key parameter to obtain an encrypted left sub-tree video file.
Optionally, the encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files respectively includes: acquiring the number of bytes of sub-video and the number of times of dividing the sub-video file in the right sub-tree; calculating a second secret key parameter corresponding to the right sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file, wherein the second secret key parameter is the same as or different from the first secret key parameter; and multithreading encrypts each sub-video file in the right sub-tree by using the second secret key parameter to obtain an encrypted right sub-tree video file, wherein the right sub-tree and the left sub-tree have different encryption algorithms.
Optionally, the splicing the plurality of encrypted sub-video files to obtain the encrypted video file includes: acquiring the byte number of each encrypted sub video file; sequencing a plurality of encrypted sub video files according to the byte number; and splicing the sequenced plurality of encrypted sub-video files to obtain the encrypted video files.
Optionally, the method further includes: when the encrypted video file is decrypted, traversing a plurality of encrypted sub-video files according to a subsequent traversal algorithm of the binary tree model to obtain an original arrangement sequence of the plurality of sub-video files; decrypting the encrypted sub-video files by adopting the encryption key parameters corresponding to each encrypted sub-video file to obtain a plurality of decrypted sub-video files; and splicing the plurality of decrypted sub-video files according to the original arrangement sequence to obtain the original video file.
According to another aspect of the embodiments of the present invention, there is also provided a video file encryption processing apparatus, including: the acquisition module is used for acquiring an original video file and the video byte number of the original video file; the segmentation module is used for segmenting the original video file by adopting a binary tree algorithm according to the number of the video bytes to obtain a plurality of sub video files; the encryption module is used for respectively encrypting each sub-video file in the plurality of sub-video files to obtain a plurality of encrypted sub-video files; and the splicing module is used for splicing the plurality of encrypted sub-video files to obtain the encrypted video files.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium storing a plurality of instructions, the instructions being adapted to be loaded by a processor and to execute any one of the above video file encryption processing methods.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory and a processor, where the memory stores a computer program, and the processor is configured to execute the computer program to perform any one of the above video file encryption processing methods.
In the embodiment of the invention, the original video file and the video byte number of the original video file are obtained; according to the number of bytes of the video, a binary tree algorithm is adopted to carry out segmentation processing on the original video file to obtain a plurality of sub video files; respectively encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files; the plurality of encrypted sub-video files are spliced to obtain the encrypted video files, and the purposes of segmenting the complete video based on the binary tree algorithm and completing encryption are achieved, so that the technical effect of carrying out double protection on the video files is achieved, and the technical problems that in the prior art, the video file encryption processing method is too single and is easy to crack are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a video file encryption processing method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of an alternative binary tree model according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a full flow of an alternative video file encryption method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a video file encryption processing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a video file encryption processing method, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be executed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be executed in an order different than that herein.
Fig. 1 is a flowchart of a video file encryption processing method according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, acquiring an original video file and the video byte number of the original video file;
step S104, according to the number of bytes of the video, a binary tree algorithm is adopted to carry out segmentation processing on the original video file to obtain a plurality of sub video files;
step S106, respectively encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files;
and step S108, splicing the plurality of encrypted sub-video files to obtain the encrypted video files.
In an embodiment of the present invention, an execution main body of the encryption processing scheme for the video file provided in the steps S102 to S108 is a server, that is, the server is adopted to obtain an original video file and a number of video bytes of the original video file; partitioning the original video file by adopting a binary tree algorithm based on the number of the video bytes to obtain a plurality of sub video files; further encrypting each sub-video file to obtain a plurality of encrypted sub-video files; and finally, splicing a plurality of encrypted sub video files to obtain an encrypted complete video file.
It should be noted that the video file encryption technology based on the binary tree algorithm provided by the invention fully combines the binary tree algorithm and the dynamic encryption technology, thereby realizing the dual protection of the video file. The video is divided into sub video files with unpredictable number, then the sub video files are encrypted through different encryption types, and the arrangement sequence of the sub video files cannot be predicted in the dividing and encrypting processes. The traditional video file protection and distribution only carries out single encryption on the video, and once a professional tool is subjected to brute force cracking, the risk of stealing exists.
As an optional embodiment, as shown in a schematic diagram of a binary tree model shown in fig. 2, the number of video bytes of the obtained original video file and the obtained original video file may be defined as a root of the binary tree model, and the binary tree model used in the embodiment of the present invention is a full binary tree model, that is, except that the last layer does not have any child node, all nodes on each layer have two child nodes; and partitioning the original video file by adopting a full binary tree algorithm, encrypting each partitioned sub-video file in different encryption modes, and finally splicing all the sub-video files to obtain the encrypted video file.
It should be noted that the encrypted sub-video files can also be stored in sequence according to the size of the number of bytes, and the original video sequence is disturbed, so that the purpose of effectively protecting the video files is achieved.
Optionally, in the server of the receiver that receives the encrypted video file, traversing the sub-video files according to a subsequent traversal method of a binary tree algorithm to obtain the original sequence of the sub-video files, and obtaining the encrypted key parameters of each sub-video file, decrypting the sub-video files in each sub-tree respectively through multiple threads, and splicing the decrypted sub-video files layer by layer according to the original sequence until the original video file is restored.
According to the embodiment of the invention, the binary tree algorithm and the dynamic encryption technology are fully combined, the double protection of the video file is realized, the video is divided into the sub-videos with unpredictable number, the sub-videos are encrypted by different encryption types, and the sequence arrangement of the sub-videos cannot be predicted, so that the purposes of dividing the complete video based on the binary tree algorithm and completing the encryption are achieved, the technical effect of double protection of the video file is realized, and the technical problems that the video file encryption processing method is too single and is easy to crack in the prior art are solved.
In an optional embodiment, the segmenting the original video file by using a binary tree algorithm according to the number of bytes of the video to obtain a plurality of sub-video files includes:
step S202, defining the tail number of the video byte number as the initial tree height value of the binary tree model, wherein if the tail number of the video byte number is 0, the initial tree height value is determined to be 10;
step S204, if the initial tree height value is divided by 2 to obtain an integer, adding 1 to the initial tree height value to obtain a current tree height value;
step S206, calculating according to the height value of the current tree to obtain the number of video segmentation nodes;
step S208, dividing the original video file into a plurality of sub-video files according to a predetermined division ratio and the number of the video division nodes.
In an embodiment of the present invention, the server defines a last number of the number of bytes of the video as an initial tree height value of the binary tree model; calculating according to the height value of the current tree to obtain the number of video segmentation nodes; and finally, according to a preset segmentation proportion and the number of the video segmentation nodes, segmenting the original video file to obtain a plurality of sub video files.
If the last number of bytes of the video is 0, determining that the initial tree height value is 10; and if the initial tree height value is divided by 2 to obtain an integer, adding 1 to the initial tree height value to serve as the current tree height value.
As an alternative embodiment, in the process of obtaining the tree height h, the number of the split sub-video files is determined according to the number n of the nodes, and the split left and right sub-trees are encrypted in different types. The process of obtaining the tree height h can calculate the tree height h according to the mantissa of the number of bytes of the video, obtain the sub-video files with different byte ratio numbers through the node number n, respectively adopt different encryption types for the sub-video files of different subtrees, sequence the sub-video files with different byte numbers, achieve the effect that the normal video sequence cannot be predicted, and thus strictly protect the video.
It should be noted that the method for sorting the sub-video files may be flexibly changed according to actual situations, and the different encryption types and the different numbers of the sub-video files of the different sub-trees are not specifically limited.
It should be noted that, in order to prevent the empty binary tree from having only a root without a sub-tree, the height of the initial binary tree is set to 2, the tree height h may be calculated by taking the mantissa of the number of bytes of the video, dividing the height value by 2, if an integer occurs, adding 1 to the tree height, and if the last mantissa is 0, taking 10 as the tree height for calculation.
In an optional embodiment, the segmenting the original video file into a plurality of sub video files according to a predetermined segmentation ratio and the number of the video segmentation nodes includes:
step S302, according to the predetermined division ratio and the number of the video division nodes, respectively generating a left sub-tree and a right sub-tree of the binary tree model from a plurality of the sub-video files obtained by dividing the original video file, wherein the number of the sub-videos at the bottom layers of the left sub-tree and the right sub-tree is the same as the number of the nodes.
In the embodiment of the present invention, according to the predetermined division ratio and the number of the video division nodes, a left sub-tree and a right sub-tree of the binary tree model are respectively generated from a plurality of the sub-video files obtained by dividing the original video file.
It should be noted that the number of the sub-videos at the bottom layers of the left sub-tree and the right sub-tree is the same as the number of nodes.
As an alternative embodiment, the node number may be calculated according to the binary tree height h, and the calculation formula is as follows: n is 2h-1The video file can be divided according to the byte ratio of 4:6, a left sub-tree and a right sub-tree of the binary tree are generated after the first division, and the number of the completely divided bottom-layer sub-video files is the same as the number n of the bottom-layer nodes.
In an optional embodiment, the encrypting each of the plurality of sub video files to obtain a plurality of encrypted sub video files respectively includes:
step S402, acquiring the number of bytes of sub-video and the number of times of dividing sub-video files in the left sub-tree;
step S404, calculating a first secret key parameter corresponding to the left sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file;
in step S406, the multithread encrypts each sub-video file in the left sub-tree by using the first secret key parameter, so as to obtain an encrypted left sub-tree video file.
In the embodiment of the invention, the byte number of the sub-video in the left sub-tree and the division times of the sub-video file are obtained; calculating to obtain a first secret key parameter corresponding to the left sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file; and multiple threads encrypt each sub video file in the left sub-tree by using the first secret key parameter to obtain an encrypted left sub-tree video file.
As an alternative embodiment, all the segmented videos and the byte number of the left sub-tree are obtained, and m is the byte number according to each sub-video1And the number of division times x of the sub video1By the formulaCalculating a key parameter e required to be encrypted by the sub-video1And starting multithreading to encrypt each sub video by adopting a data Encryption standard Des (data Encryption Standard).
In an optional embodiment, the encrypting each of the plurality of sub video files to obtain a plurality of encrypted sub video files respectively includes:
step S502, acquiring the number of bytes of the sub-video and the number of times of splitting the sub-video file in the right sub-tree;
step S504, calculating a second secret key parameter corresponding to the right sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file, wherein the second secret key parameter is the same as or different from the first secret key parameter;
in step S506, multiple threads encrypt each sub-video file in the right sub-tree by using the second secret key parameter to obtain an encrypted right sub-tree video file, where the right sub-tree and the left sub-tree have different encryption algorithms.
In the embodiment of the invention, the byte number of the sub-video in the right sub-tree and the division times of the sub-video file are obtained; calculating to obtain a first secret key parameter corresponding to the right sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file; and multiple threads encrypt each sub video file in the right sub-tree by adopting the first secret key parameter to obtain an encrypted right sub-tree video file.
As an alternative embodiment, all the segmented videos and the byte number of the right subtree are obtained, and m bytes are calculated according to the byte number of each sub video2Number of division of sum sub video v2By the formulaCalculating a key parameter e required to be encrypted by the sub-video2And starting multithreading to encrypt each sub video by adopting advanced Encryption standard (advanced Encryption Standard).
In an optional embodiment, the splicing the plurality of encrypted sub video files to obtain an encrypted video file includes:
step S602, acquiring the byte number of each encrypted sub-video file;
step S604, according to the byte number, sequencing a plurality of encrypted sub-video files;
step S606, a plurality of ordered encrypted sub-video files are spliced to obtain the encrypted video file.
As an optional embodiment, the encrypted sub-video files are sorted and stored according to the size of byte number or other manners, the original video sequence is disturbed, and the sorted plurality of encrypted sub-video files are spliced to obtain the encrypted video files, so that the video files are effectively protected.
In an optional embodiment, the method further includes:
step S702, when the encrypted video file is decrypted, traversing a plurality of encrypted sub-video files according to the subsequent traversal algorithm of the binary tree model to obtain the original arrangement sequence of the plurality of sub-video files;
step S704, decrypting the encrypted sub-video files by using the encryption key parameter corresponding to each encrypted sub-video file to obtain a plurality of decrypted sub-video files;
step S706, splicing the plurality of decrypted sub-video files according to the original arrangement order to obtain the original video file.
As an optional embodiment, in a server of a receiver that receives the encrypted video file, traversing the sub-video files according to a post-order traversal method of a binary tree algorithm to obtain an original order of the sub-video files, obtaining encryption key parameters of each sub-video file, decrypting each sub-tree sub-video file through multiple threads, and splicing each decrypted sub-video file layer by layer according to the original order until the original video file is restored.
Through the steps, as shown in the full-flow schematic diagram of the video file encryption method shown in fig. 3, double protection of a video file can be realized, the video is divided into sub-videos with unpredictable number, the sub-videos are encrypted by different encryption types, and the sequential arrangement of the sub-videos cannot be predicted, so that the purposes of dividing a complete video based on a binary tree algorithm and completing encryption are achieved, the technical effect of double protection of the video file is realized, and the technical problems that the video file encryption processing method in the prior art is too single and is easy to crack are solved.
Example 2
According to an embodiment of the present invention, there is further provided an embodiment of an apparatus for implementing the above video file encryption processing, and fig. 4 is a schematic structural diagram of an apparatus for encrypting a video file according to an embodiment of the present invention, as shown in fig. 4, the apparatus includes: an acquisition module 40, a segmentation module 42, an encryption module 44, and a concatenation module 46, wherein:
an obtaining module 40, configured to obtain an original video file and a number of video bytes of the original video file;
a partitioning module 42, configured to partition the original video file by using a binary tree algorithm according to the number of bytes of the video, so as to obtain multiple sub-video files;
an encryption module 44, configured to encrypt each of the multiple sub-video files to obtain multiple encrypted sub-video files;
and the splicing module 46 is configured to splice a plurality of encrypted sub-video files to obtain an encrypted video file.
It should be noted here that the obtaining module 40, the dividing module 42, the encrypting module 44, and the splicing module 46 correspond to steps S102 to S108 in embodiment 1, and the four modules are the same as the corresponding steps in the implementation example and the application scenario, but are not limited to the disclosure in embodiment 1.
It should be noted that, reference may be made to the relevant description in embodiment 1 for a preferred implementation of this embodiment, and details are not described here again.
Embodiments of a computer-readable storage medium are also provided according to embodiments of the present invention. Optionally, in this embodiment, the computer-readable storage medium may be configured to store the program code executed by the video file encryption processing provided in embodiment 1.
Optionally, in this embodiment, the computer-readable storage medium may be located in any one of computer terminals in a computer terminal group in a computer network, or in any one of mobile terminals in a mobile terminal group.
Optionally, in this embodiment, the computer readable storage medium is configured to store program codes for performing the following steps: acquiring an original video file and the video byte number of the original video file; according to the number of bytes of the video, a binary tree algorithm is adopted to carry out segmentation processing on the original video file to obtain a plurality of sub video files; respectively encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files; and splicing the plurality of encrypted sub-video files to obtain the encrypted video files.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: defining the tail number of the video byte number as the initial tree height value of the binary tree model, wherein if the tail number of the video byte number is 0, the initial tree height value is determined to be 10; if the initial tree height value is divided by 2 to obtain an integer, adding 1 to the initial tree height value to obtain a current tree height value; calculating according to the height value of the current tree to obtain the number of video segmentation nodes; and dividing the original video file into a plurality of sub video files according to a preset division ratio and the number of the video division nodes.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: and according to the preset segmentation proportion and the number of the video segmentation nodes, respectively generating a left sub-tree and a right sub-tree of the binary tree model from a plurality of the sub-video files obtained by segmenting the original video file, wherein the number of the sub-videos at the bottommost layers of the left sub-tree and the right sub-tree is the same as the number of the nodes.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: acquiring the number of bytes of sub-video and the number of times of dividing the sub-video file in the left sub-tree; calculating to obtain a first secret key parameter corresponding to the left sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file; and multiple threads encrypt each sub video file in the left sub-tree by using the first secret key parameter to obtain an encrypted left sub-tree video file.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: acquiring the number of bytes of sub-video and the number of times of dividing the sub-video file in the right sub-tree; calculating a second secret key parameter corresponding to the right sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file, wherein the second secret key parameter is the same as or different from the first secret key parameter; and multithreading encrypts each sub-video file in the right sub-tree by using the second secret key parameter to obtain an encrypted right sub-tree video file, wherein the right sub-tree and the left sub-tree have different encryption algorithms.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: acquiring the byte number of each encrypted sub video file; sequencing a plurality of encrypted sub video files according to the byte number; and splicing the sequenced plurality of encrypted sub-video files to obtain the encrypted video files.
Optionally, the computer-readable storage medium may further include program code for performing the following steps: when the encrypted video file is decrypted, traversing a plurality of encrypted sub-video files according to a subsequent traversal algorithm of the binary tree model to obtain an original arrangement sequence of the plurality of sub-video files; decrypting the encrypted sub-video files by adopting the encryption key parameters corresponding to each encrypted sub-video file to obtain a plurality of decrypted sub-video files; and splicing the plurality of decrypted sub-video files according to the original arrangement sequence to obtain the original video file.
Embodiments of a processor are also provided according to embodiments of the present invention. Optionally, in this embodiment, the computer-readable storage medium may be configured to store the program code executed by the video file encryption processing provided in embodiment 1.
The embodiment of the application provides an electronic device, the device comprises a processor, a memory and a program which is stored on the memory and can be run on the processor, and the processor executes the program and realizes the following steps: acquiring an original video file and the video byte number of the original video file; according to the number of bytes of the video, a binary tree algorithm is adopted to carry out segmentation processing on the original video file to obtain a plurality of sub video files; respectively encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files; and splicing the plurality of encrypted sub-video files to obtain the encrypted video files.
Optionally, the electronic device may further execute program codes of the following steps: defining the tail number of the video byte number as the initial tree height value of the binary tree model, wherein if the tail number of the video byte number is 0, the initial tree height value is determined to be 10; if the initial tree height value is divided by 2 to obtain an integer, adding 1 to the initial tree height value to obtain a current tree height value; calculating according to the height value of the current tree to obtain the number of video segmentation nodes; and dividing the original video file into a plurality of sub video files according to a preset division ratio and the number of the video division nodes.
Optionally, the electronic device may further execute program codes of the following steps: and according to the preset segmentation proportion and the number of the video segmentation nodes, respectively generating a left sub-tree and a right sub-tree of the binary tree model from a plurality of the sub-video files obtained by segmenting the original video file, wherein the number of the sub-videos at the bottommost layers of the left sub-tree and the right sub-tree is the same as the number of the nodes.
Optionally, the electronic device may further execute program codes of the following steps: acquiring the number of bytes of sub-video and the number of times of dividing the sub-video file in the left sub-tree; calculating to obtain a first secret key parameter corresponding to the left sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file; and multiple threads encrypt each sub video file in the left sub-tree by using the first secret key parameter to obtain an encrypted left sub-tree video file.
Optionally, the electronic device may further execute program codes of the following steps: acquiring the number of bytes of sub-video and the number of times of dividing the sub-video file in the right sub-tree; calculating a second secret key parameter corresponding to the right sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file, wherein the second secret key parameter is the same as or different from the first secret key parameter; and multithreading encrypts each sub-video file in the right sub-tree by using the second secret key parameter to obtain an encrypted right sub-tree video file, wherein the right sub-tree and the left sub-tree have different encryption algorithms.
Optionally, the electronic device may further execute program codes of the following steps: acquiring the byte number of each encrypted sub video file; sequencing a plurality of encrypted sub video files according to the byte number; and splicing the sequenced plurality of encrypted sub-video files to obtain the encrypted video files.
Optionally, the electronic device may further execute program codes of the following steps: when the encrypted video file is decrypted, traversing a plurality of encrypted sub-video files according to a subsequent traversal algorithm of the binary tree model to obtain an original arrangement sequence of the plurality of sub-video files; decrypting the encrypted sub-video files by adopting the encryption key parameters corresponding to each encrypted sub-video file to obtain a plurality of decrypted sub-video files; and splicing the plurality of decrypted sub-video files according to the original arrangement sequence to obtain the original video file.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: acquiring an original video file and the video byte number of the original video file; according to the number of bytes of the video, a binary tree algorithm is adopted to carry out segmentation processing on the original video file to obtain a plurality of sub video files; respectively encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files; and splicing the plurality of encrypted sub-video files to obtain the encrypted video files.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.
Claims (10)
1. A video file encryption processing method is characterized by comprising the following steps:
acquiring an original video file and the video byte number of the original video file;
according to the number of video bytes, a binary tree algorithm is adopted to carry out segmentation processing on the original video file to obtain a plurality of sub video files;
respectively encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files;
and splicing the plurality of encrypted sub-video files to obtain an encrypted video file.
2. The method of claim 1, wherein the segmenting the original video file by using a binary tree algorithm according to the number of bytes of the video to obtain a plurality of sub-video files comprises:
defining the tail number of the video byte number as an initial tree height value of a binary tree model, wherein if the tail number of the video byte number is 0, the initial tree height value is determined to be 10;
if the initial tree height value is divided by 2 to obtain an integer, adding 1 to the initial tree height value to obtain a current tree height value;
calculating according to the height value of the current tree to obtain the number of video segmentation nodes;
and according to a preset segmentation proportion and the number of the video segmentation nodes, segmenting the original video file to obtain a plurality of sub video files.
3. The method according to claim 2, wherein said dividing the original video file into a plurality of sub-video files according to a predetermined division ratio and the number of video division nodes comprises:
and respectively generating a left sub-tree and a right sub-tree of the binary tree model from a plurality of sub-video files obtained by segmenting the original video file according to the preset segmentation proportion and the video segmentation node number, wherein the number of the sub-videos at the bottommost layers of the left sub-tree and the right sub-tree is the same as the node number.
4. The method according to claim 3, wherein the separately encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files comprises:
acquiring the number of bytes of sub-video and the number of times of sub-video file division in the left sub-tree;
calculating to obtain a first secret key parameter corresponding to the left sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file;
and multiple threads encrypt each sub video file in the left sub-tree by using the first secret key parameter to obtain an encrypted left sub-tree video file.
5. The method according to claim 4, wherein the separately encrypting each of the plurality of sub-video files to obtain a plurality of encrypted sub-video files comprises:
acquiring the number of bytes of sub-video and the number of times of sub-video file division in the right sub-tree;
calculating to obtain a second secret key parameter corresponding to the right sub-tree according to the number of bytes of the sub-video and the number of times of splitting the sub-video file, wherein the second secret key parameter is the same as or different from the first secret key parameter;
and multithreading encrypts each sub-video file in the right sub-tree by using the second secret key parameter to obtain an encrypted right sub-tree video file, wherein the right sub-tree and the left sub-tree have different encryption algorithms.
6. The method according to claim 1, wherein said splicing the plurality of encrypted sub-video files to obtain an encrypted video file comprises:
acquiring the byte number of each encrypted sub video file;
sequencing the plurality of encrypted sub-video files according to the byte number;
and splicing the sequenced plurality of encrypted sub-video files to obtain the encrypted video files.
7. The method of claim 6, further comprising:
when the encrypted video file is decrypted, traversing the plurality of encrypted sub-video files according to a subsequent traversal algorithm of a binary tree model to obtain the original arrangement sequence of the plurality of sub-video files;
decrypting the encrypted sub-video files by adopting the encryption key parameters corresponding to each encrypted sub-video file to obtain a plurality of decrypted sub-video files;
and splicing the plurality of decrypted sub-video files according to the original arrangement sequence to obtain the original video file.
8. A video file encryption processing apparatus, comprising:
the acquisition module is used for acquiring an original video file and the video byte number of the original video file;
the segmentation module is used for segmenting the original video file by adopting a binary tree algorithm according to the number of video bytes to obtain a plurality of sub video files;
the encryption module is used for respectively encrypting each sub-video file in the plurality of sub-video files to obtain a plurality of encrypted sub-video files;
and the splicing module is used for splicing the plurality of encrypted sub-video files to obtain the encrypted video files.
9. A computer-readable storage medium storing a plurality of instructions adapted to be loaded by a processor and to perform the video file encryption processing method according to any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to perform the video file encryption processing method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111631083.0A CN114329555A (en) | 2021-12-28 | 2021-12-28 | Video file encryption processing method and device, storage medium and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111631083.0A CN114329555A (en) | 2021-12-28 | 2021-12-28 | Video file encryption processing method and device, storage medium and equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114329555A true CN114329555A (en) | 2022-04-12 |
Family
ID=81015760
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111631083.0A Pending CN114329555A (en) | 2021-12-28 | 2021-12-28 | Video file encryption processing method and device, storage medium and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114329555A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115802106A (en) * | 2022-11-15 | 2023-03-14 | 上海游密信息科技有限公司 | Video encryption transmission method and device, electronic equipment and storage medium |
-
2021
- 2021-12-28 CN CN202111631083.0A patent/CN114329555A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115802106A (en) * | 2022-11-15 | 2023-03-14 | 上海游密信息科技有限公司 | Video encryption transmission method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10778441B2 (en) | Redactable document signatures | |
CN102693398B (en) | Data encryption method and system | |
Liu et al. | Reversible data hiding in encrypted images using chunk encryption and redundancy matrix representation | |
KR101405720B1 (en) | Accelerated cryptography with an encryption attribute | |
EP1503590B1 (en) | Access control for digital video stream data | |
US8000472B2 (en) | Information encryption apparatus and controlling method of the same, computer program and computer readable storage medium | |
GB2404489A (en) | Access control for digital storage medium content | |
GB2404538A (en) | Access control for digital content | |
GB2404486A (en) | Access control for digital storage medium content | |
GB2404487A (en) | Access control for digital storage medium content | |
CN114329555A (en) | Video file encryption processing method and device, storage medium and equipment | |
KR101553986B1 (en) | System and method of distrubuted data storage, restoration | |
CN116015982B (en) | Encryption and decryption methods and equipment for network security data transmission | |
KR101496764B1 (en) | Method and apparatus for managing file to recover original file with at least pre-determined number file fragments | |
CN112182512A (en) | Information processing method, device and storage medium | |
CN114419719B (en) | Biological characteristic processing method and device | |
CN116582314A (en) | Optimal hidden double-protection text method | |
GB2404488A (en) | Access control data for linear storage medium | |
CN109446827A (en) | Data encryption/decryption method and system | |
US20110123023A1 (en) | Apparatus for video encryption by randomized block shuffling and method thereof | |
CN114282922A (en) | Block chain transaction processing method and device based on cold wallet | |
CN107729766B (en) | Data storage method, data reading method and system thereof | |
CN113408012A (en) | Fault detection | |
CN117240627B (en) | Network data information secure transmission method and system | |
CN114465826B (en) | Data encryption method, system and storage medium of coding technology |
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 |