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
- encrypted
- mentioned
- 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.)
- Withdrawn
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 18
- 238000000034 method Methods 0.000 claims abstract description 39
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 33
- 230000011218 segmentation Effects 0.000 claims abstract description 20
- 230000008569 process Effects 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 6
- 230000000694 effects Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000013478 data encryption standard Methods 0.000 description 2
- 238000005336 cracking Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Images
Landscapes
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
本发明公开了一种视频文件加密处理方法、装置、存储介质及设备。其中,该方法包括:获取原始视频文件和上述原始视频文件的视频字节数;根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件。本发明解决了现有技术中视频文件加密处理方法过于单一,存在容易被破解的技术问题。
The invention discloses a video file encryption processing method, device, storage medium and equipment. Wherein, the method includes: obtaining the original video file and the number of video bytes of the above-mentioned original video file; according to the above-mentioned number of video bytes, using a binary tree algorithm to perform segmentation processing on the above-mentioned original video file to obtain a plurality of sub-video files; Each sub-video file in the above-mentioned sub-video files is encrypted to obtain a plurality of encrypted sub-video files; and a plurality of the above-mentioned encrypted sub-video files are spliced to obtain an encrypted video file. The invention solves the technical problem that the encryption processing method of the video file in the prior art is too simple and easy to be cracked.
Description
技术领域technical field
本发明涉及信息安全技术领域,具体而言,涉及一种视频文件加密处理方法、装置、存储介质及设备。The present invention relates to the technical field of information security, and in particular, to a video file encryption processing method, device, storage medium and device.
背景技术Background technique
通过录取视频的方式来记录生活中的点点滴滴,在用户生活中已经成为主流,而在视频的保护方面的相关技术却非常欠缺,导致每个用户都存在被不法份子利用漏洞来盗取用户隐私视频为己谋利的风险。Recording every bit of life by recording videos has become mainstream in users' lives, but the related technologies in video protection are very lacking, resulting in every user being exploited by criminals to steal users. Risk of privacy videos for your own benefit.
现有技术中,对视频文件保护的方式大同小异,大都采用各类不同的手段从视频文件中获取秘钥,然后通过秘钥对视频文件进行加密处理,例如:直接对视频文件中的关键帧预置字节或字段的数据进行加密处理,得到相对应的秘钥;通过秘钥对视频文件进行加密。一旦秘钥被非法获取,视频文件就极有可能被盗取,现有的加密方法过于单一且容易被暴力破解,并不能做到对视频的有效保护。In the prior art, the methods of protecting video files are similar, and most of them use various different means to obtain secret keys from the video files, and then encrypt the video files by using the secret keys, for example: directly pre-preserving key frames in the video files. Encrypt the data in bytes or fields to obtain the corresponding secret key; encrypt the video file through the secret key. Once the secret key is illegally obtained, the video file is very likely to be stolen. The existing encryption method is too simple and easy to be cracked by brute force, and cannot effectively protect the video.
针对上述的问题,目前尚未提出有效的解决方案。For the above problems, no effective solution has been proposed yet.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供了一种视频文件加密处理方法、装置、存储介质及设备,以至少解决现有技术中视频文件加密处理方法过于单一,存在容易被破解的技术问题。Embodiments of the present invention provide a video file encryption processing method, device, storage medium and device, to at least solve the technical problem that the video file encryption processing method in the prior art is too simple and easy to be cracked.
根据本发明实施例的一个方面,提供了一种视频文件加密处理方法,包括:获取原始视频文件和上述原始视频文件的视频字节数;根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件。According to an aspect of the embodiments of the present invention, a video file encryption processing method is provided, including: obtaining an original video file and the number of video bytes of the original video file; The file is divided into a plurality of sub-video files to obtain a plurality of sub-video files; each sub-video file in the plurality of above-mentioned sub-video files is encrypted to obtain a plurality of encrypted sub-video files; After splicing, an encrypted video file is obtained.
可选的,上述根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件,包括:将上述视频字节数的末尾数定义为上述二叉树模型的初始树高度值,其中,若上述视频字节数的末尾数为0,则确定上述初始树高度值为10;如果将上述初始树高度值除以2得到整数,则将上述初始树高度值加1,得到当前树高度值;根据上述当前树高度值计算得到视频分割节点数;按照预定分割比例和上述视频分割节点数,将上述原始视频文件分割得到多个上述子视频文件。Optionally, according to the above-mentioned number of video bytes, the above-mentioned original video file is divided and processed by a binary tree algorithm to obtain a plurality of sub-video files, including: defining the last number of the above-mentioned video byte number as the initial tree height of the above-mentioned binary tree model. If the last number of the above-mentioned video bytes is 0, then the above-mentioned initial tree height value is determined to be 10; if the above-mentioned initial tree height value is divided by 2 to obtain an integer, then the above-mentioned initial tree height value is added by 1 to obtain current tree height value; calculating the number of video segmentation nodes according to the current tree height value; dividing the original video file according to a predetermined segmentation ratio and the number of video segmentation nodes to obtain a plurality of the sub-video files.
可选的,上述按照预定分割比例和上述视频分割节点数,将上述原始视频文件分割得到多个上述子视频文件,包括:按照上述预定分割比例和上述视频分割节点数,将分割上述原始视频文件得到的多个上述子视频文件,分别生成上述二叉树模型的左子树和右子树,其中,上述左子树和上述右子树的最底层的子视频数量和节点数相同。Optionally, the above-mentioned dividing the above-mentioned original video file according to the predetermined dividing ratio and the above-mentioned number of video dividing nodes to obtain a plurality of above-mentioned sub-video files includes: dividing the above-mentioned original video file according to the above-mentioned predetermined dividing ratio and the above-mentioned number of video dividing nodes. The obtained multiple above-mentioned sub-video files respectively generate the left sub-tree and the right sub-tree of the above-mentioned binary tree model, wherein the number of sub-videos at the bottommost level and the number of nodes of the above-mentioned left sub-tree and the above-mentioned right sub-tree are the same.
可选的,上述分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件,包括:获取上述左子树中的子视频字节数和子视频文件分割次数;根据上述子视频字节数和上述子视频文件分割次数,计算得到上述左子树对应的第一秘钥参数;多线程采用上述第一秘钥参数对上述左子树中的各个子视频文件进行加密,得到加密后的左子树视频文件。Optionally, the above-mentioned encryption processing is performed on each sub-video file in the plurality of above-mentioned sub-video files respectively, and a plurality of encrypted sub-video files are obtained, including: obtaining the sub-video bytes and sub-video files in the above-mentioned left sub-tree. The number of divisions; according to the above-mentioned sub-video byte number and the above-mentioned sub-video file division times, the first secret key parameter corresponding to the above-mentioned left subtree is obtained by calculating; The video file is encrypted to obtain an encrypted left subtree video file.
可选的,上述分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件,包括:获取上述右子树中的子视频字节数和子视频文件分割次数;根据上述子视频字节数和上述子视频文件分割次数,计算得到上述右子树对应的的第二秘钥参数,其中,上述第二秘钥参数与上述第一秘钥参数相同或不同;多线程采用上述第二秘钥参数对上述右子树中的各个子视频文件进行加密,得到加密后的右子树视频文件,其中,上述右子树与上述左子树的加密算法不同。Optionally, the above-mentioned encryption processing is performed on each sub-video file in the plurality of above-mentioned sub-video files respectively, and a plurality of encrypted sub-video files are obtained, including: obtaining the sub-video bytes and sub-video files in the above-mentioned right subtree. The number of times of division; according to the number of sub-video bytes and the number of times of division of the sub-video file, the second key parameter corresponding to the above-mentioned right subtree is obtained by calculating, wherein the above-mentioned second key parameter is the same as the above-mentioned first key parameter or Different; multithreading adopts above-mentioned second secret key parameter to encrypt each sub-video file in above-mentioned right subtree, obtains the right subtree video file after encryption, wherein, the encryption algorithm of above-mentioned right subtree and above-mentioned left subtree is different .
可选的,上述对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件,包括:获取每个上述加密后的子视频文件的字节数大小;按照上述字节数大小,对多个上述加密后的子视频文件进行排序处理;对排序后的多个上述加密后的子视频文件进行拼接处理,得到上述加密后视频文件。Optionally, performing the splicing process on a plurality of the above-mentioned encrypted sub-video files to obtain the encrypted video files includes: obtaining the size in bytes of each of the above-mentioned encrypted sub-video files; according to the above-mentioned size in bytes, Perform sorting processing on a plurality of the above encrypted sub-video files; perform splicing processing on the sorted plurality of the above-mentioned encrypted sub-video files to obtain the above-mentioned encrypted video files.
可选的,上述方法还包括:在对上述加密后视频文件进行解密处理时,根据上述二叉树模型的后序遍历算法对多个上述加密后的子视频文件进行遍历,得到多个上述子视频文件的原有排列顺序;采用每个上述加密后的子视频文件对应的加密秘钥参数,对上述加密后的子视频文件进行解密处理,得到多个解密后的上述子视频文件;按照上述原有排列顺序对多个解密后的上述子视频文件进行拼接处理,得到上述原始视频文件。Optionally, the above-mentioned method further includes: when performing decryption processing on the above-mentioned encrypted video files, traversing a plurality of above-mentioned encrypted sub-video files according to a post-order traversal algorithm of the above-mentioned binary tree model to obtain a plurality of above-mentioned sub-video files. The original arrangement sequence; adopt the encryption key parameter corresponding to each above-mentioned encrypted sub-video file, decrypt the above-mentioned encrypted sub-video file, and obtain a plurality of decrypted above-mentioned sub-video files; According to the above-mentioned original The above-mentioned original video files are obtained by performing splicing processing on the plurality of decrypted above-mentioned sub-video files in order of arrangement.
根据本发明实施例的另一方面,还提供了一种视频文件加密处理装置,包括:获取模块,用于获取原始视频文件和上述原始视频文件的视频字节数;分割模块,用于根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;加密模块,用于分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;拼接模块,用于对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件。According to another aspect of the embodiments of the present invention, a video file encryption processing device is also provided, including: an acquisition module for acquiring the original video file and the number of video bytes of the above-mentioned original video file; The number of video bytes, the binary tree algorithm is used to divide the above-mentioned original video file to obtain a plurality of sub-video files; the encryption module is used to encrypt each sub-video file in the plurality of above-mentioned sub-video files respectively to obtain a plurality of encrypted sub-video files. The splicing module is used to perform splicing processing on a plurality of the above encrypted sub-video files to obtain an encrypted video file.
根据本发明实施例的另一方面,还提供了一种计算机可读存储介质,上述计算机可读存储介质存储有多条指令,上述指令适于由处理器加载并执行任意一项上述的视频文件加密处理方法。According to another aspect of the embodiments of the present invention, a computer-readable storage medium is also provided, where the computer-readable storage medium stores a plurality of instructions, and the instructions are adapted to be loaded and executed by a processor of any one of the above-mentioned video files. Encryption processing method.
根据本发明实施例的另一方面,还提供了一种电子设备,包括存储器和处理器,上述存储器中存储有计算机程序,上述处理器被设置为运行上述计算机程序以执行任意一项上述的视频文件加密处理方法。According to another aspect of the embodiments of the present invention, an electronic device is also provided, including a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to execute any one of the above videos File encryption processing method.
在本发明实施例中,通过获取原始视频文件和上述原始视频文件的视频字节数;根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件,达到了对完整视频基于二叉树算法进行分割并完成加密的目的,从而实现了对视频文件进行双重保护的技术效果,进而解决了现有技术中视频文件加密处理方法过于单一,存在容易被破解的技术问题。In the embodiment of the present invention, the original video file and the number of video bytes of the above-mentioned original video file are obtained; according to the above-mentioned number of video bytes, a binary tree algorithm is used to divide the above-mentioned original video file to obtain a plurality of sub-video files; Each sub-video file in the plurality of above-mentioned sub-video files is encrypted to obtain a plurality of encrypted sub-video files; and the plurality of above-mentioned encrypted sub-video files are spliced to obtain encrypted video files, which achieves complete integrity. The video is segmented and encrypted based on the binary tree algorithm, thereby realizing the technical effect of double protection of the video file, thereby solving the technical problem that the encryption processing method of the video file in the prior art is too simple and easy to be cracked.
附图说明Description of drawings
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The accompanying drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the attached image:
图1是根据本发明实施例的视频文件加密处理方法流程图;1 is a flowchart of a video file encryption processing method according to an embodiment of the present invention;
图2是根据本发明实施例的一种可选的二叉树模型示意图;2 is a schematic diagram of an optional binary tree model according to an embodiment of the present invention;
图3是根据本发明实施例的一种可选的视频文件加密方法全流程示意图;3 is a schematic diagram of the entire process of an optional video file encryption method according to an embodiment of the present invention;
图4是根据本发明实施例的一种视频文件加密处理装置的结构示意图。FIG. 4 is a schematic structural diagram of a video file encryption processing apparatus according to an embodiment of the present invention.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to make those skilled in the art better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only Embodiments are part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts 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 the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
实施例1Example 1
根据本发明实施例,提供了一种视频文件加密处理方法的实施例,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。According to an embodiment of the present invention, an embodiment of a video file encryption processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawing can be executed in a computer system such as a set of computer-executable instructions, and , although a logical order is shown in the flowcharts, in some cases steps shown or described may be performed in an order different from that herein.
图1是根据本发明实施例的视频文件加密处理方法流程图,如图1所示,该方法包括如下步骤: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:
步骤S102,获取原始视频文件和上述原始视频文件的视频字节数;Step S102, obtaining the video bytes of the original video file and the above-mentioned original video file;
步骤S104,根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;Step S104, according to the above-mentioned video byte count, adopt binary tree algorithm to carry out segmentation processing to above-mentioned original video file, obtain a plurality of sub-video files;
步骤S106,分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;Step S106, respectively encrypting each sub-video file in the plurality of above-mentioned sub-video files to obtain a plurality of encrypted sub-video files;
步骤S108,对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件。Step S108, performing a splicing process on a plurality of the above-mentioned encrypted sub-video files to obtain an encrypted video file.
在本发明实施例中,上述步骤S102至S108中提供的视频文件的加密处理方案的执行主体为服务器,即采用上述服务器获取原始视频文件和上述原始视频文件的视频字节数;采用二叉树算法基于上述视频字节数对上述原始视频文件进行分割处理,得到多个子视频文件;进而对每个上述子视频文件进行加密处理,得到多个加密后的子视频文件;最后将多个上述加密后的子视频文件拼接起来,获得加密后的完整的视频文件。In the embodiment of the present invention, the execution subject of the encryption processing scheme of the video file provided in the above steps S102 to S108 is the server, that is, the above server is used to obtain the original video file and the number of video bytes of the above original video file; the binary tree algorithm is used based on the The above-mentioned video bytes are divided into the above-mentioned original video files to obtain a plurality of sub-video files; and then each above-mentioned sub-video file is encrypted to obtain a plurality of encrypted sub-video files; The sub-video files are spliced together to obtain an encrypted complete video file.
需要说明的是,本发明提出的基于二叉树算法的视频文件加密技术,将二叉树算法和动态加密技术进行了充分结合,实现了视频文件的双重保护。通过将视频分割为无法预知数量的子视频文件,再将子视频文件通过不同的加密类型进行加密,并且,在分割和加密的过程中无法预知子视频文件的排列顺序。而传统的视频文件保护发放只对视频进行单一加密,一旦面临专业工具进行暴力破解,则存在被盗取的风险。It should be noted that the video file encryption technology based on the binary tree algorithm proposed by the present invention fully combines the binary tree algorithm and the dynamic encryption technology to realize the double protection of the video file. By dividing the video into an unpredictable number of sub-video files, and then encrypting the sub-video files with different encryption types, the arrangement order of the sub-video files cannot be predicted during the process of dividing and encrypting. However, the traditional video file protection and distribution only performs single encryption on the video, and once faced with professional tools for brute force cracking, there is a risk of being stolen.
作为一种可选的实施例,如图2所示的二叉树模型示意图,获取到的上述原始视频文件和上述原始视频文件的视频字节数可以定义为二叉树模型的根,且本发明实施例中使用的二叉树模型为满二叉树模型,即除最后一层无任何子节点外,每一层上的所有节点都有两个子节点;采用满二叉树算法对上述原始视频文件进行分割处理,将分割后的每个子视频文件通过不同的加密方式进行加密,最后拼接上述全部子视频文件得到加密后的视频文件。As an optional embodiment, as shown in the schematic diagram of the binary tree model shown in FIG. 2 , the obtained original video file and the number of video bytes of the original video file may be defined as the root of the binary tree model, and in the embodiment of the present invention The binary tree model used is a full binary tree model, that is, all nodes on each layer have two child nodes except the last layer without any child nodes; the full binary tree algorithm is used to divide the above original video file, and the divided Each sub-video file is encrypted by different encryption methods, and finally all the sub-video files above are spliced to obtain an encrypted video file.
需要说明的是,还可以将加密后的子视频文件按字节数大小进行排序存放,打乱原视频顺序,从而达到对视频文件进行有效保护的目的。It should be noted that the encrypted sub-video files can also be sorted and stored according to the size of the bytes, and the sequence of the original video can be disrupted, so as to achieve the purpose of effectively protecting the video files.
可选的,在接收到上述加密后的视频文件的接收方的服务器中,根据二叉树算法的后序遍历法对子视频文件进行遍历,获取到子视频文件的原有顺序,并获取各个子视频文件加密的秘钥参数,通过多线程分别对各个子树中子视频文件进行解密,将解密后的各个子视频文件按原有顺序进行逐层拼接,直至原视频文件被恢复为止。Optionally, in the server of the receiver that receives the above-mentioned encrypted video file, the sub-video files are traversed according to the post-order traversal method of the binary tree algorithm, the original order of the sub-video files is obtained, and each sub-video file is obtained. The key parameter of file encryption is to decrypt the sub-video files in each sub-tree separately through multi-threading, and splicing the decrypted sub-video files layer by layer in the original order until the original video file is restored.
通过本发明实施例,将二叉树算法和动态加密技术进行了充分结合,实现了视频文件的双重保护,并且将视频分割为无法预知数量的子视频,子视频通过不同的加密类型去加密,无法预知子视频的顺序排列,达到了对完整视频基于二叉树算法进行分割并完成加密的目的,从而实现了对视频文件进行双重保护的技术效果,进而解决了现有技术中视频文件加密处理方法过于单一,存在容易被破解的技术问题。Through the embodiment of the present invention, the binary tree algorithm and the dynamic encryption technology are fully combined, the double protection of the video file is realized, and the video is divided into an unpredictable number of sub-videos, and the sub-videos are encrypted by different encryption types. The sequential arrangement of the sub-videos achieves the purpose of dividing and encrypting the complete video based on the binary tree algorithm, thereby realizing the technical effect of double-protecting the video file, and solving the problem that the encryption processing method of the video file in the prior art is too simple, There are technical problems that can be easily cracked.
在一种可选的实施例中,上述根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件,包括:In an optional embodiment, according to the above-mentioned number of video bytes, the above-mentioned original video file is segmented by a binary tree algorithm to obtain a plurality of sub-video files, including:
步骤S202,将上述视频字节数的末尾数定义为上述二叉树模型的初始树高度值,其中,若上述视频字节数的末尾数为0,则确定上述初始树高度值为10;Step S202, the last number of the above-mentioned video bytes is defined as the initial tree height value of the above-mentioned binary tree model, wherein, if the last number of the above-mentioned video bytes is 0, then determine that the above-mentioned initial tree height value is 10;
步骤S204,如果将上述初始树高度值除以2得到整数,则将上述初始树高度值加1,得到当前树高度值;Step S204, if the above-mentioned initial tree height value is divided by 2 to obtain an integer, then the above-mentioned initial tree height value is added by 1 to obtain the current tree height value;
步骤S206,根据上述当前树高度值计算得到视频分割节点数;Step S206, calculating the number of video segmentation nodes according to the above-mentioned current tree height value;
步骤S208,按照预定分割比例和上述视频分割节点数,将上述原始视频文件分割得到多个上述子视频文件。Step S208: Divide the original video file according to a predetermined division ratio and the number of video division nodes to obtain a plurality of sub-video files.
在本发明实施例中,上述服务器将上述视频字节数的末尾数定义为上述二叉树模型的初始树高度值;根据上述当前树高度值计算得到视频分割节点数;最后按照预定分割比例和上述视频分割节点数,将上述原始视频文件分割得到多个上述子视频文件。In the embodiment of the present invention, the server defines the last number of the video bytes as the initial tree height value of the binary tree model; the number of video segmentation nodes is calculated according to the current tree height value; The number of dividing nodes is used to divide the above-mentioned original video file to obtain a plurality of above-mentioned sub-video files.
需要说明的是,若上述视频字节数的末尾数为0,则确定上述初始树高度值为10;如果将上述初始树高度值除以2得到一个整数,则将上述初始树高度值加1,作为当前树高度值。It should be noted that if the last number of the above-mentioned video bytes is 0, the above-mentioned initial tree height value is determined to be 10; if the above-mentioned initial tree height value is divided by 2 to obtain an integer, then the above-mentioned initial tree height value is added by 1 , as the current tree height value.
作为一种可选的实施例,获取树高度h的过程中,根据节点数n来确定分割的子视频文件数量,并将分割后的左、右子树进行不同类型加密。上述获取树高度h的过程可以根据视频字节数的尾数,计算树高度h,通过节点数n来获取到不同字节比例数量的子视频文件,不同子树的子视频文件分别采取不同的加密类型,将各个不同字节数的子视频文件进行排序,达到无法预知正常视频顺序的效果,从而对视频进行严密的保护。As an optional embodiment, in the process of obtaining the tree height h, the number of sub-video files to be divided is determined according to the number of nodes n, and the divided left and right sub-trees are encrypted in different types. The above process of obtaining the tree height h can calculate the tree height h according to the mantissa of the number of video bytes, and obtain sub-video files with different byte ratios through the number of nodes n. The sub-video files of different subtrees are encrypted in different ways. Type, sort the sub-video files with different numbers of bytes to achieve the effect of unpredictable normal video sequence, so as to strictly protect the video.
需要说明的是,上述子视频文件进行排序方法可以根据实际情况进行灵活更改,上述不同子树的子视频文件分别采取的不同加密类型与数量也不作具体限定。It should be noted that the sorting method of the above sub-video files can be flexibly changed according to the actual situation, and the different encryption types and numbers of the sub-video files of different sub-trees are not specifically limited.
还需要说明的是,为防止出现空二叉树只有根没有子树的情况,设定初始二叉树的高度为2,树高度h的计算可以取视频字节数尾数,将其高度值除以2,若出现整数,则将树高加1,若末尾数为0,则取10作为树高进行计算。It should also be noted that, in order to prevent an empty binary tree with only roots and no subtrees, the height of the initial binary tree is set to 2, and the tree height h can be calculated by taking the mantissa of the number of video bytes, and dividing its height value by 2. If If an integer appears, add 1 to the tree height. If the last number is 0, take 10 as the tree height for calculation.
在一种可选的实施例中,上述按照预定分割比例和上述视频分割节点数,将上述原始视频文件分割得到多个上述子视频文件,包括:In an optional embodiment, the above-mentioned original video file is divided according to a predetermined division ratio and the above-mentioned number of video division nodes to obtain a plurality of above-mentioned sub-video files, including:
步骤S302,按照上述预定分割比例和上述视频分割节点数,将分割上述原始视频文件得到的多个上述子视频文件,分别生成上述二叉树模型的左子树和右子树,其中,上述左子树和上述右子树的最底层的子视频数量和节点数相同。Step S302, according to the above-mentioned predetermined division ratio and the above-mentioned number of video division nodes, a plurality of above-mentioned sub-video files obtained by dividing the above-mentioned original video file are respectively generated. The left sub-tree and the right sub-tree of the binary tree model, wherein the left sub-tree It is the same as the number of sub-videos and the number of nodes at the bottom of the above right sub-tree.
在本发明实施例中,按照上述预定分割比例和上述视频分割节点数,将分割上述原始视频文件得到的多个上述子视频文件,分别生成上述二叉树模型的左子树和右子树。In this embodiment of the present invention, according to the predetermined division ratio and the number of video division nodes, the left subtree and the right subtree of the binary tree model are respectively generated from the plurality of sub-video files obtained by dividing the original video file.
需要说明的是,上述左子树和上述右子树的最底层的子视频数量和节点数相同。It should be noted that the number of sub-videos and the number of nodes at the lowest level of the left subtree and the right subtree are the same.
作为一种可选的实施例,节点数可以根据二叉树高度h计算得出,计算公式如下:n=2h-1,视频文件分割可以按照字节数比例为4:6的方式进行分割,第一次分割之后产生二叉树的左子树和右子树,完整分割后的最底层子视频文件数量和最底层节点数n相同。As an optional embodiment, the number of nodes can be calculated according to the height h of the binary tree, and the calculation formula is as follows: n=2 h-1 , and the video file can be divided according to the ratio of the number of bytes to 4:6. After one division, the left subtree and the right subtree of the binary tree are generated, and the number of the bottommost sub-video files after the complete division is the same as the number n of the bottommost nodes.
在一种可选的实施例中,上述分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件,包括:In an optional embodiment, each of the above-mentioned multiple sub-video files is encrypted to obtain a plurality of encrypted sub-video files, including:
步骤S402,获取上述左子树中的子视频字节数和子视频文件分割次数;Step S402, obtaining the sub-video bytes and sub-video file division times in the above-mentioned left subtree;
步骤S404,根据上述子视频字节数和上述子视频文件分割次数,计算得到上述左子树对应的第一秘钥参数;Step S404, according to the above-mentioned sub-video byte number and the above-mentioned sub-video file division times, calculate and obtain the first secret key parameter corresponding to the above-mentioned left subtree;
步骤S406,多线程采用上述第一秘钥参数对上述左子树中的各个子视频文件进行加密,得到加密后的左子树视频文件。Step S406: Multithreading encrypts each sub-video file in the above-mentioned left sub-tree by using the above-mentioned first secret key parameter, and obtains an encrypted left sub-tree video file.
在本发明实施例中,获取上述左子树中的子视频字节数和子视频文件的分割次数;根据上述子视频字节数和上述子视频文件分割次数,计算得到上述左子树对应的第一秘钥参数;多线程采用上述第一秘钥参数对上述左子树中的各个子视频文件进行加密,得到加密后的左子树视频文件。In the embodiment of the present invention, the number of sub-video bytes in the above-mentioned left subtree and the number of times of division of the sub-video file are obtained; according to the above-mentioned number of bytes of the sub-video and the above-mentioned number of times of division of the sub-video file, the first number corresponding to the above-mentioned left subtree is obtained by calculating a secret key parameter; multithreading uses the first secret key parameter to encrypt each sub-video file in the left subtree, and obtains an encrypted left subtree video file.
作为一种可选的实施例,获取左子树所有分割后的视频和字节数,根据每个子视频字节数m1和子视频的分割次数x1,通过公式计算出该子视频所需加密的秘钥参数e1,并开启多线程对各个子视频采用数据加密标准Des(Data Encryption Standard)进行加密。As an optional embodiment, obtain all the divided videos and the number of bytes of the left subtree, according to the number of bytes m 1 of each sub-video and the number of times of division x 1 of the sub-video, by formula The key parameter e 1 required to be encrypted for the sub-video is calculated, and multi-threading is started to encrypt each sub-video using the data encryption standard Des (Data Encryption Standard).
在一种可选的实施例中,上述分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件,包括:In an optional embodiment, each of the above-mentioned multiple sub-video files is encrypted to obtain a plurality of encrypted sub-video files, including:
步骤S502,获取上述右子树中的子视频字节数和子视频文件分割次数;Step S502, obtaining the sub-video bytes and sub-video file division times in the above-mentioned right subtree;
步骤S504,根据上述子视频字节数和上述子视频文件分割次数,计算得到上述右子树对应的的第二秘钥参数,其中,上述第二秘钥参数与上述第一秘钥参数相同或不同;Step S504: Calculate the second key parameter corresponding to the right subtree according to the number of bytes of the sub-video and the number of times of dividing the sub-video file, wherein the second key parameter is the same as the first key parameter or different;
步骤S506,多线程采用上述第二秘钥参数对上述右子树中的各个子视频文件进行加密,得到加密后的右子树视频文件,其中,上述右子树与上述左子树的加密算法不同。Step S506: Multithreading uses the above-mentioned second key parameter to encrypt each sub-video file in the above-mentioned right sub-tree to obtain an encrypted right sub-tree video file, wherein the encryption algorithm of the above-mentioned right sub-tree and the above-mentioned left sub-tree different.
在本发明实施例中,获取上述右子树中的子视频字节数和子视频文件的分割次数;根据上述子视频字节数和上述子视频文件分割次数,计算得到上述右子树对应的第一秘钥参数;多线程采用上述第一秘钥参数对上述右子树中的各个子视频文件进行加密,得到加密后的右子树视频文件。In the embodiment of the present invention, the number of sub-video bytes in the above-mentioned right subtree and the number of times of division of the sub-video file are obtained; according to the above-mentioned number of bytes of the sub-video and the above-mentioned number of times of division of the sub-video file, the first number corresponding to the above-mentioned right subtree is obtained by calculating a secret key parameter; multithreading uses the first secret key parameter to encrypt each sub-video file in the right subtree to obtain an encrypted right subtree video file.
作为一种可选的实施例,获取右子树所有分割后的视频和字节数,根据每个子视频字节数m2和子视频的分割次数v2,通过公式计算出该子视频所需加密的秘钥参数e2,开启多线程对各个子视频采用高级加密标准Aes(Advanced EncryptionStandard)进行加密。As an optional embodiment, obtain all the divided videos and the number of bytes of the right subtree, according to the number of bytes m 2 of each sub-video and the number of times of division v 2 of the sub-video, by formula The key parameter e 2 required to be encrypted for the sub-video is calculated, and multi-threading is enabled to encrypt each sub-video using the Advanced Encryption Standard Aes (Advanced Encryption Standard).
在一种可选的实施例中,上述对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件,包括:In an optional embodiment, the above-mentioned splicing processing is performed on a plurality of the above-mentioned encrypted sub-video files to obtain encrypted video files, including:
步骤S602,获取每个上述加密后的子视频文件的字节数大小;Step S602, obtaining the byte size of each above-mentioned encrypted sub-video file;
步骤S604,按照上述字节数大小,对多个上述加密后的子视频文件进行排序处理;Step S604, sorting and processing a plurality of the above-mentioned encrypted sub-video files according to the above-mentioned size of the number of bytes;
步骤S606,对排序后的多个上述加密后的子视频文件进行拼接处理,得到上述加密后视频文件。Step S606: Perform a splicing process on the sorted plurality of the above-mentioned encrypted sub-video files to obtain the above-mentioned encrypted video files.
作为一种可选的实施例,将加密过后的子视频文件按字节数大小或其他方式进行排序存放,打乱原视频顺序,对排序后的多个上述加密后的子视频文件进行拼接处理,得到上述加密后视频文件,从而实现对视频文件进行有效的保护。As an optional embodiment, the encrypted sub-video files are sorted and stored by the size of bytes or in other ways, the sequence of the original video is disrupted, and a splicing process is performed on the sorted plurality of the above-mentioned encrypted sub-video files. , to obtain the above-mentioned encrypted video file, thereby realizing effective protection of the video file.
在一种可选的实施例中,上述方法还包括:In an optional embodiment, the above method further includes:
步骤S702,在对上述加密后视频文件进行解密处理时,根据上述二叉树模型的后序遍历算法对多个上述加密后的子视频文件进行遍历,得到多个上述子视频文件的原有排列顺序;Step S702, when performing decryption processing on the above-mentioned encrypted video files, traverse the plurality of above-mentioned encrypted sub-video files according to the post-order traversal algorithm of the above-mentioned binary tree model, and obtain the original arrangement order of the plurality of above-mentioned sub-video files;
步骤S704,采用每个上述加密后的子视频文件对应的加密秘钥参数,对上述加密后的子视频文件进行解密处理,得到多个解密后的上述子视频文件;Step S704, using the encryption key parameter corresponding to each of the above-mentioned encrypted sub-video files, decrypt the above-mentioned encrypted sub-video files, and obtain a plurality of above-mentioned decrypted sub-video files;
步骤S706,按照上述原有排列顺序对多个解密后的上述子视频文件进行拼接处理,得到上述原始视频文件。Step S706, performing splicing processing on the plurality of decrypted sub-video files according to the original arrangement order to obtain the original video file.
作为一种可选的实施例,在接收到上述加密后的视频文件的接收方的服务器中,根据二叉树算法的后序遍历法对子视频文件进行遍历,获取到子视频文件的原有顺序,并获取各个子视频文件加密的秘钥参数,通过多线程分别对各个子树中子视频文件进行解密,将解密后的各个子视频文件按原有顺序进行逐层拼接,直至原视频文件被恢复为止。As an optional embodiment, in the server of the receiver receiving the above-mentioned encrypted video file, the sub-video files are traversed according to the post-order traversal method of the binary tree algorithm, and the original order of the sub-video files is obtained, And obtain the encrypted key parameters of each sub-video file, decrypt the sub-video files in each sub-tree by multi-threading, and splicing the decrypted sub-video files layer by layer in the original order until the original video file is restored. until.
通过上述步骤,如图3所示的视频文件加密方法全流程示意图,可以实现视频文件的双重保护,并且将视频分割为无法预知数量的子视频,子视频通过不同的加密类型去加密,无法预知子视频的顺序排列,达到了对完整视频基于二叉树算法进行分割并完成加密的目的,从而实现了对视频文件进行双重保护的技术效果,进而解决了现有技术中视频文件加密处理方法过于单一,存在容易被破解的技术问题。Through the above steps, as shown in the schematic diagram of the whole process of the video file encryption method as shown in Figure 3, the double protection of the video file can be realized, and the video can be divided into an unpredictable number of sub-videos. The sequential arrangement of the sub-videos achieves the purpose of dividing and encrypting the complete video based on the binary tree algorithm, thereby realizing the technical effect of double-protecting the video file, and solving the problem that the encryption processing method of the video file in the prior art is too simple, There are technical problems that can be easily cracked.
实施例2Example 2
根据本发明实施例,还提供了一种用于实施上述视频文件加密处理的装置实施例,图4是根据本发明实施例的一种视频文件加密处理装置的结构示意图,如图4所示,上述装置包括:获取模块40、分割模块42、加密模块44和拼接模块46,其中:According to an embodiment of the present invention, an embodiment of an apparatus for implementing the above video file encryption processing is also provided. FIG. 4 is a schematic structural diagram of a video file encryption processing apparatus according to an embodiment of the present invention, as shown in FIG. 4 , The above device includes: an acquisition module 40, a segmentation module 42, an encryption module 44 and a splicing module 46, wherein:
获取模块40,用于获取原始视频文件和上述原始视频文件的视频字节数;Obtaining module 40 is used to obtain the video bytes of the original video file and the above-mentioned original video file;
分割模块42,用于根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;The segmentation module 42 is used to perform segmentation processing on the above-mentioned original video file by adopting a binary tree algorithm according to the above-mentioned number of video bytes to obtain a plurality of sub-video files;
加密模块44,用于分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;Encryption module 44 is used to encrypt each sub-video file in a plurality of above-mentioned sub-video files respectively to obtain a plurality of encrypted sub-video files;
拼接模块46,用于对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件。The splicing module 46 is configured to perform splicing processing on a plurality of the above-mentioned encrypted sub-video files to obtain encrypted video files.
此处需要说明的是,上述获取模块40、分割模块42、加密模块44和拼接模块46对应于实施例1中的步骤S102至步骤S108,四个模块与对应的步骤所实现的实例和应用场景相同,但不限于上述实施例1所公开的内容。It should be noted here that the above-mentioned acquisition module 40, segmentation module 42, encryption module 44 and splicing module 46 correspond to steps S102 to S108 in
需要说明的是,本实施例的优选实施方式可以参见实施例1中的相关描述,此处不再赘述。It should be noted that, for the preferred implementation of this embodiment, reference may be made to the relevant description in
根据本发明的实施例,还提供了一种计算机可读存储介质的实施例。可选的,在本实施例中,上述计算机可读存储介质可以用于保存上述实施例1所提供的视频文件加密处理所执行的程序代码。According to an embodiment of the present invention, there is also provided an embodiment of a computer-readable storage medium. Optionally, in this embodiment, the above-mentioned computer-readable storage medium may be used to store the program code executed by the video file encryption process provided in the above-mentioned
可选的,在本实施例中,上述计算机可读存储介质可以位于计算机网络中计算机终端群中的任意一个计算机终端中,或者位于移动终端群中的任意一个移动终端中。Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
可选的,在本实施例中,计算机可读存储介质被设置为存储用于执行以下步骤的程序代码:获取原始视频文件和上述原始视频文件的视频字节数;根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件。Optionally, in this embodiment, a computer-readable storage medium is configured to store program codes for performing the following steps: obtaining the original video file and the video byte count of the above-mentioned original video file; according to the above-mentioned video byte count, The above-mentioned original video files are divided by binary tree algorithm to obtain a plurality of sub-video files; each sub-video file in the plurality of above-mentioned sub-video files is encrypted respectively to obtain a plurality of encrypted sub-video files; The encrypted sub-video files are spliced to obtain an encrypted video file.
可选的,上述计算机可读存储介质还可以执行如下步骤的程序代码:将上述视频字节数的末尾数定义为上述二叉树模型的初始树高度值,其中,若上述视频字节数的末尾数为0,则确定上述初始树高度值为10;如果将上述初始树高度值除以2得到整数,则将上述初始树高度值加1,得到当前树高度值;根据上述当前树高度值计算得到视频分割节点数;按照预定分割比例和上述视频分割节点数,将上述原始视频文件分割得到多个上述子视频文件。Optionally, the above-mentioned computer-readable storage medium can also execute the program code of the following steps: the last number of the above-mentioned video bytes is defined as the initial tree height value of the above-mentioned binary tree model, wherein, if the last number of the above-mentioned video bytes is counted. If it is 0, the above initial tree height value is determined to be 10; if the above initial tree height value is divided by 2 to obtain an integer, then the above initial tree height value is added by 1 to obtain the current tree height value; Calculated according to the above current tree height value The number of video segmentation nodes; according to a predetermined segmentation ratio and the number of video segmentation nodes, the original video file is divided to obtain a plurality of the sub-video files.
可选的,上述计算机可读存储介质还可以执行如下步骤的程序代码:按照上述预定分割比例和上述视频分割节点数,将分割上述原始视频文件得到的多个上述子视频文件,分别生成上述二叉树模型的左子树和右子树,其中,上述左子树和上述右子树的最底层的子视频数量和节点数相同。Optionally, the above-mentioned computer-readable storage medium can also execute the program code of the following steps: according to the above-mentioned predetermined division ratio and the above-mentioned number of video division nodes, the above-mentioned multiple sub-video files obtained by dividing the above-mentioned original video file are respectively generated. The above-mentioned binary tree is generated. The left subtree and the right subtree of the model, wherein the number of sub-videos and the number of nodes at the bottommost level of the above left subtree and the above right subtree are the same.
可选的,上述计算机可读存储介质还可以执行如下步骤的程序代码:获取上述左子树中的子视频字节数和子视频文件分割次数;根据上述子视频字节数和上述子视频文件分割次数,计算得到上述左子树对应的第一秘钥参数;多线程采用上述第一秘钥参数对上述左子树中的各个子视频文件进行加密,得到加密后的左子树视频文件。Optionally, the above-mentioned computer-readable storage medium can also execute the program code of the following steps: obtain the number of sub-video bytes in the above-mentioned left subtree and the number of times of sub-video file division; number of times to obtain the first key parameter corresponding to the left subtree; multithreading uses the first key parameter to encrypt each sub-video file in the left subtree to obtain an encrypted left subtree video file.
可选的,上述计算机可读存储介质还可以执行如下步骤的程序代码:获取上述右子树中的子视频字节数和子视频文件分割次数;根据上述子视频字节数和上述子视频文件分割次数,计算得到上述右子树对应的的第二秘钥参数,其中,上述第二秘钥参数与上述第一秘钥参数相同或不同;多线程采用上述第二秘钥参数对上述右子树中的各个子视频文件进行加密,得到加密后的右子树视频文件,其中,上述右子树与上述左子树的加密算法不同。Optionally, the above-mentioned computer-readable storage medium can also execute the program code of the following steps: obtain the number of sub-video bytes in the above-mentioned right subtree and the number of times of sub-video file division; times, the second key parameter corresponding to the above-mentioned right subtree is obtained by calculating, wherein the above-mentioned second key parameter is the same as or different from the above-mentioned first key parameter; multithreading adopts the above-mentioned second key parameter to the above-mentioned right subtree Each sub-video file in is encrypted to obtain an encrypted right sub-tree video file, wherein the encryption algorithm of the above-mentioned right sub-tree and the above-mentioned left sub-tree is different.
可选的,上述计算机可读存储介质还可以执行如下步骤的程序代码:获取每个上述加密后的子视频文件的字节数大小;按照上述字节数大小,对多个上述加密后的子视频文件进行排序处理;对排序后的多个上述加密后的子视频文件进行拼接处理,得到上述加密后视频文件。Optionally, the above-mentioned computer-readable storage medium can also execute the program code of the following steps: obtaining the byte size of each of the above-mentioned encrypted sub-video files; Perform sorting processing on the video files; perform splicing processing on a plurality of the above-mentioned encrypted sub-video files after sorting to obtain the above-mentioned encrypted video files.
可选的,上述计算机可读存储介质还可以执行如下步骤的程序代码:在对上述加密后视频文件进行解密处理时,根据上述二叉树模型的后序遍历算法对多个上述加密后的子视频文件进行遍历,得到多个上述子视频文件的原有排列顺序;采用每个上述加密后的子视频文件对应的加密秘钥参数,对上述加密后的子视频文件进行解密处理,得到多个解密后的上述子视频文件;按照上述原有排列顺序对多个解密后的上述子视频文件进行拼接处理,得到上述原始视频文件。Optionally, the above-mentioned computer-readable storage medium can also execute the program code of the following steps: when the above-mentioned encrypted video file is decrypted, according to the post-order traversal algorithm of the above-mentioned binary tree model, a plurality of above-mentioned encrypted sub-video files are processed. Perform traversal to obtain the original arrangement order of a plurality of the above-mentioned sub-video files; using the encryption key parameter corresponding to each of the above-mentioned encrypted sub-video files, decrypt the above-mentioned encrypted sub-video files, and obtain a plurality of decrypted sub-video files. The above-mentioned sub-video files are spliced according to the above-mentioned original arrangement order, and the above-mentioned original video files are obtained.
根据本发明的实施例,还提供了一种处理器的实施例。可选的,在本实施例中,上述计算机可读存储介质可以用于保存上述实施例1所提供的视频文件加密处理所执行的程序代码。According to an embodiment of the present invention, an embodiment of a processor is also provided. Optionally, in this embodiment, the above-mentioned computer-readable storage medium may be used to store the program code executed by the video file encryption process provided in the above-mentioned
本申请实施例提供了一种电子设备,设备包括处理器、存储器及存储在存储器上并可在处理器上运行的程序,处理器执行程序时实现以下步骤:获取原始视频文件和上述原始视频文件的视频字节数;根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件。An embodiment of the present application provides an electronic device, the device includes a processor, a memory, and a program stored in the memory and running on the processor, and the processor implements the following steps when executing the program: acquiring an original video file and the above-mentioned original video file According to the above-mentioned video bytes, the above-mentioned original video file is divided and processed by the binary tree algorithm to obtain a plurality of sub-video files; each sub-video file in the plurality of above-mentioned sub-video files is encrypted and processed to obtain A plurality of encrypted sub-video files; performing splicing processing on a plurality of the above-mentioned encrypted sub-video files to obtain an encrypted video file.
可选的,上述电子设备还可以执行如下步骤的程序代码:将上述视频字节数的末尾数定义为上述二叉树模型的初始树高度值,其中,若上述视频字节数的末尾数为0,则确定上述初始树高度值为10;如果将上述初始树高度值除以2得到整数,则将上述初始树高度值加1,得到当前树高度值;根据上述当前树高度值计算得到视频分割节点数;按照预定分割比例和上述视频分割节点数,将上述原始视频文件分割得到多个上述子视频文件。Optionally, the above-mentioned electronic device can also execute the program code of the following steps: the end number of the above-mentioned video byte number is defined as the initial tree height value of the above-mentioned binary tree model, wherein, if the above-mentioned video byte number The end number of the number is 0, Then it is determined that the above-mentioned initial tree height value is 10; if the above-mentioned initial tree height value is divided by 2 to obtain an integer, then the above-mentioned initial tree height value is added by 1 to obtain the current tree height value; the video segmentation node is calculated according to the above-mentioned current tree height value. according to the predetermined division ratio and the number of the above-mentioned video division nodes, divide the above-mentioned original video file to obtain a plurality of above-mentioned sub-video files.
可选的,上述电子设备还可以执行如下步骤的程序代码:按照上述预定分割比例和上述视频分割节点数,将分割上述原始视频文件得到的多个上述子视频文件,分别生成上述二叉树模型的左子树和右子树,其中,上述左子树和上述右子树的最底层的子视频数量和节点数相同。Optionally, the above-mentioned electronic device may also execute the program code of the following steps: according to the above-mentioned predetermined division ratio and the above-mentioned number of video division nodes, a plurality of above-mentioned sub-video files obtained by dividing the above-mentioned original video file are respectively generated to generate the left side of the above-mentioned binary tree model. A subtree and a right subtree, wherein the number of sub-videos and the number of nodes at the bottom of the left subtree and the right subtree are the same.
可选的,上述电子设备还可以执行如下步骤的程序代码:获取上述左子树中的子视频字节数和子视频文件分割次数;根据上述子视频字节数和上述子视频文件分割次数,计算得到上述左子树对应的第一秘钥参数;多线程采用上述第一秘钥参数对上述左子树中的各个子视频文件进行加密,得到加密后的左子树视频文件。Optionally, the above-mentioned electronic device can also execute the program code of the following steps: obtain the sub-video bytes and sub-video file division times in the above-mentioned left subtree; calculate the sub-video bytes and sub-video file division times according to the above-mentioned sub-video bytes Obtain the first secret key parameter corresponding to the left subtree; multithreading uses the first secret key parameter to encrypt each sub-video file in the left subtree to obtain an encrypted left subtree video file.
可选的,上述电子设备还可以执行如下步骤的程序代码:获取上述右子树中的子视频字节数和子视频文件分割次数;根据上述子视频字节数和上述子视频文件分割次数,计算得到上述右子树对应的的第二秘钥参数,其中,上述第二秘钥参数与上述第一秘钥参数相同或不同;多线程采用上述第二秘钥参数对上述右子树中的各个子视频文件进行加密,得到加密后的右子树视频文件,其中,上述右子树与上述左子树的加密算法不同。Optionally, the above-mentioned electronic equipment can also execute the program code of the following steps: obtain the sub-video bytes and sub-video file division times in the above-mentioned right subtree; calculate the sub-video bytes and sub-video file division times according to the above-mentioned sub-video bytes Obtain the second key parameter corresponding to the above-mentioned right subtree, wherein the above-mentioned second key parameter is the same as or different from the above-mentioned first key parameter; multithreading adopts the above-mentioned second key parameter to each The sub-video file is encrypted to obtain an encrypted right sub-tree video file, wherein the encryption algorithms of the above-mentioned right sub-tree and the above-mentioned left sub-tree are different.
可选的,上述电子设备还可以执行如下步骤的程序代码:获取每个上述加密后的子视频文件的字节数大小;按照上述字节数大小,对多个上述加密后的子视频文件进行排序处理;对排序后的多个上述加密后的子视频文件进行拼接处理,得到上述加密后视频文件。Optionally, the above-mentioned electronic device can also execute the program code of the following steps: obtain the size of the number of bytes of each of the above-mentioned encrypted sub-video files; Sorting processing: performing splicing processing on the sorted plurality of the above-mentioned encrypted sub-video files to obtain the above-mentioned encrypted video files.
可选的,上述电子设备还可以执行如下步骤的程序代码:在对上述加密后视频文件进行解密处理时,根据上述二叉树模型的后序遍历算法对多个上述加密后的子视频文件进行遍历,得到多个上述子视频文件的原有排列顺序;采用每个上述加密后的子视频文件对应的加密秘钥参数,对上述加密后的子视频文件进行解密处理,得到多个解密后的上述子视频文件;按照上述原有排列顺序对多个解密后的上述子视频文件进行拼接处理,得到上述原始视频文件。Optionally, the above-mentioned electronic device can also execute the program code of the following steps: when performing decryption processing on the above-mentioned encrypted video file, traverse a plurality of the above-mentioned encrypted sub-video files according to the post-order traversal algorithm of the above-mentioned binary tree model, Obtain the original arrangement order of a plurality of above-mentioned sub-video files; adopt the encryption key parameter corresponding to each above-mentioned encrypted sub-video file, decrypt the above-mentioned encrypted sub-video files, and obtain a plurality of decrypted above-mentioned sub-video files. Video files; perform splicing processing on a plurality of decrypted sub-video files according to the above-mentioned original arrangement order to obtain the above-mentioned original video files.
本申请还提供了一种计算机程序产品,当在数据处理设备上执行时,适于执行初始化有如下方法步骤的程序:获取原始视频文件和上述原始视频文件的视频字节数;根据上述视频字节数,采用二叉树算法对上述原始视频文件进行分割处理,得到多个子视频文件;分别对多个上述子视频文件中的每个子视频文件进行加密处理,得到多个加密后的子视频文件;对多个上述加密后的子视频文件进行拼接处理,得到加密后视频文件。The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program initialized with the following method steps: obtaining an original video file and the number of video bytes of the above-mentioned original video file; number of sections, using binary tree algorithm to perform segmentation processing on the above-mentioned original video file to obtain a plurality of sub-video files; respectively encrypting each sub-video file in the plurality of above-mentioned sub-video files to obtain a plurality of encrypted sub-video files; A plurality of the above encrypted sub-video files are spliced to obtain an encrypted video file.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.
在本发明的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,可以为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are only illustrative, for example, the division of the units may be a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of units or modules, and may be in electrical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes .
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above are only the preferred embodiments of the present invention. It should be pointed out that for those skilled in the art, without departing from the principles of the present invention, several improvements and modifications can be made. It should be regarded as the protection scope of the present invention.
Claims (10)
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 Withdrawn 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 |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040120529A1 (en) * | 2002-09-23 | 2004-06-24 | International Business Machines Corporation | Key distribution in a conditional access system |
CN103414552A (en) * | 2013-07-31 | 2013-11-27 | 深圳信息职业技术学院 | Method and device for encrypting and decrypting by using binary tree traversal mode |
CN105208404A (en) * | 2015-08-26 | 2015-12-30 | 北京新东方迅程网络科技有限公司 | Video encryption and decryption method and device |
-
2021
- 2021-12-28 CN CN202111631083.0A patent/CN114329555A/en not_active Withdrawn
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040120529A1 (en) * | 2002-09-23 | 2004-06-24 | International Business Machines Corporation | Key distribution in a conditional access system |
CN103414552A (en) * | 2013-07-31 | 2013-11-27 | 深圳信息职业技术学院 | Method and device for encrypting and decrypting by using binary tree traversal mode |
CN105208404A (en) * | 2015-08-26 | 2015-12-30 | 北京新东方迅程网络科技有限公司 | Video encryption and decryption method and device |
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 |
---|---|---|
US7260215B2 (en) | Method for encryption in an un-trusted environment | |
JP6533291B2 (en) | Method and apparatus for encrypting / decrypting data on a mobile terminal | |
CN100563152C (en) | Data division method and device using exclusive-or operation | |
US8000472B2 (en) | Information encryption apparatus and controlling method of the same, computer program and computer readable storage medium | |
CN1602600A (en) | Content processing device and content protection program | |
CN104636462B (en) | A kind of rapidly searching ciphertext method and system that can resist Statistical Analysis Attacks | |
CN106878013A (en) | Method and device for encrypting and decrypting files | |
CN107291861A (en) | A kind of approximate beeline querying method of belt restraining towards encryption figure | |
KR101553986B1 (en) | System and method of distrubuted data storage, restoration | |
CN108305298B (en) | An Image Restorable Information Hiding Method Based on Sudoku Matrix Index | |
JP4954972B2 (en) | Discard key determination method and determination device, decryption method and decryption device, and recording medium | |
CN104794673B (en) | Utilize the encrypted domain reversible digital watermarking implementation method of highest significant position | |
CN114329555A (en) | Video file encryption processing method and device, storage medium and equipment | |
CN104040935B (en) | A kind of data encryption, the method and apparatus of decryption | |
Njoum et al. | High-Secured Image LSB Steganography Using AVL-Tree with Random RGB Channel Substitution. | |
CN112818404B (en) | Data access permission updating method, device, equipment and readable storage medium | |
CN112702582B (en) | Secure transmission method and device for monitoring video based on SM2 | |
KR20160001598A (en) | Method and system for generating host keys for storage devices | |
Kar et al. | An improved data security using DNA sequencing | |
CN111368317A (en) | Computer data encryption system and method | |
Wu et al. | A compound chaos-based encryption algorithm for vector geographic data under network circumstance | |
CN113206926B (en) | A method based on three-pixel encryption to balance image privacy and usability | |
CN112508764B (en) | Encryption method for balancing image privacy and usability based on information embedding | |
Yassir et al. | Hybrid Image Encryption Technique for Securing Color Images Transmitted Over Cloud Networks. | |
US9571468B2 (en) | Encoding data using a variable number of pixels and bits based on entropy |
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 | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20220412 |