[go: up one dir, main page]

CN114386062A - Switch encryption method and device and electronic equipment - Google Patents

Switch encryption method and device and electronic equipment Download PDF

Info

Publication number
CN114386062A
CN114386062A CN202111609934.1A CN202111609934A CN114386062A CN 114386062 A CN114386062 A CN 114386062A CN 202111609934 A CN202111609934 A CN 202111609934A CN 114386062 A CN114386062 A CN 114386062A
Authority
CN
China
Prior art keywords
random number
open state
number sequence
value
numerical value
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
Application number
CN202111609934.1A
Other languages
Chinese (zh)
Inventor
杜丽丽
杨金
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Aisino Corp
Original Assignee
Aisino Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Aisino Corp filed Critical Aisino Corp
Priority to CN202111609934.1A priority Critical patent/CN114386062A/en
Publication of CN114386062A publication Critical patent/CN114386062A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/629Protecting access to data via a platform, e.g. using keys or access control rules to features or functions of an application

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

本申请公开了一种开关加密方法、装置及电子设备,该方法包括:在包含多个随机数的第一随机数序列中确定出第一数值;根据当前权限对应的开放状态及第一数值,计算得到第二数值;将第二数值插入第一随机数序列中,得到第二随机数序列;将第二随机数序列作为开放状态对应的第一指示标识。通过上述方法,将当前权限对应的开放状态设置成一个随机序列数,避免当前权限的开放状态被篡改,安全性高。

Figure 202111609934

The present application discloses a switch encryption method, device and electronic device. The method includes: determining a first value in a first random number sequence including multiple random numbers; according to the open state and the first value corresponding to the current authority, The second numerical value is obtained by calculation; the second numerical value is inserted into the first random number sequence to obtain the second random number sequence; and the second random number sequence is used as the first indication mark corresponding to the open state. Through the above method, the open state corresponding to the current permission is set to a random sequence number, so that the open state of the current permission is prevented from being tampered with, and the security is high.

Figure 202111609934

Description

一种开关加密方法、装置及电子设备A switch encryption method, device and electronic device

技术领域technical field

本申请涉及计算机技术领域,特别是涉及一种开关加密方法、装置及电子设备。The present application relates to the field of computer technology, and in particular, to a switch encryption method, device and electronic device.

背景技术Background technique

随着软件技术的发展,针对某些用户灵活开放特定功能权限的场景越来越多,例如开票领域,有的用户开普票,有的需要开具专票,有的用户普票和专票都需开具,并且在用户开票过程中,可能会需要增加或者删除开票种类。With the development of software technology, there are more and more scenarios in which certain users can flexibly open specific function permissions. For example, in the field of invoicing, some users issue general tickets, while others need to issue special tickets. It needs to be issued, and in the process of user invoicing, it may be necessary to add or delete invoicing types.

为了实现对用户灵活开放特定功能权限,现有技术通常都是利用配置文件或者数据表字段控制,比如,使用“1”或者“是”表示开放某一功能权限,使用“0”或者“否”表示关闭某一功能权限。如果用户知晓这种控制原理,极容易更改权限设置。In order to flexibly open specific function permissions to users, the existing technology usually uses configuration files or data table fields to control, for example, use "1" or "Yes" to indicate opening a certain function authority, use "0" or "No" Indicates that a function permission is disabled. If the user knows this control principle, it is very easy to change the permission settings.

发明内容SUMMARY OF THE INVENTION

本申请提供了一种驾驶状态检测方法、装置及电子设备,将当前权限对应的开放状态设置成一个序列数,从而避免当前权限的开放状态被篡改,安全性高。The present application provides a driving state detection method, device, and electronic device, which set the open state corresponding to the current authority to a sequence number, thereby preventing the open state of the current authority from being tampered with, with high security.

第一方面,本申请提供了一种开关加密方法,所述方法包括:In a first aspect, the present application provides a switch encryption method, the method comprising:

在包含多个随机数的第一随机数序列中确定出第一数值;determining a first numerical value in a first random number sequence including a plurality of random numbers;

根据当前权限对应的开放状态及所述第一数值,计算得到第二数值;Calculate the second value according to the open state corresponding to the current authority and the first value;

将所述第二数值插入所述第一随机数序列中,得到第二随机数序列;inserting the second numerical value into the first random number sequence to obtain a second random number sequence;

将所述第二随机数序列作为所述开放状态对应的第一指示标识。The second random number sequence is used as the first indication identifier corresponding to the open state.

通过上述方法,将当前权限对应的开放状态设置成一个序列数,从而避免当前权限的开放状态被篡改,安全性高。Through the above method, the open state corresponding to the current permission is set as a sequence number, so that the open state of the current permission is prevented from being tampered with, and the security is high.

在一种可能的设计中,所述根据当前权限对应的开放状态及所述第一数值,计算得到第二数值,包括:In a possible design, calculating the second value according to the open state corresponding to the current permission and the first value, including:

检测所述当前权限对应的开放状态;detecting the open state corresponding to the current permission;

若所述当前权限为开启状态,则获取第一预设参数;If the current permission is in an open state, acquiring a first preset parameter;

将所述第一数值与所述第一预设参数输入预设计算模型,得到所述第二数值。Inputting the first numerical value and the first preset parameter into a preset calculation model to obtain the second numerical value.

通过上述方法,在当前权限为开启状态时,生成开启状态对应的数值,该数值用于生成开启状态对应的随机数序列。Through the above method, when the current permission is in the open state, a numerical value corresponding to the open state is generated, and the numerical value is used to generate a random number sequence corresponding to the open state.

在一种可能的设计中,所述根据当前权限对应的开放状态及所述第一数值,计算得到第二数值,包括:In a possible design, calculating the second value according to the open state corresponding to the current permission and the first value, including:

检测所述当前权限对应的开放状态;detecting the open state corresponding to the current permission;

若所述当前权限为关闭状态,则获取第二预设参数;If the current permission is in an off state, acquiring a second preset parameter;

将所述第一数值与所述第二预设参数输入预设计算模型,得到所述第二数值。Inputting the first value and the second preset parameter into a preset calculation model to obtain the second value.

通过上述方法,在当前权限为关闭状态时,生成关闭状态对应的数值,该数值用于生成关闭状态对应的随机数序列。Through the above method, when the current permission is in the closed state, a numerical value corresponding to the closed state is generated, and the numerical value is used to generate a random number sequence corresponding to the closed state.

在一种可能的设计中,所述将所述第二数值插入所述第一随机数序列中,得到第二随机数序列,包括:In a possible design, inserting the second value into the first random number sequence to obtain a second random number sequence, including:

确定所述第一数值为M,其中,M为整数;Determine that the first numerical value is M, where M is an integer;

将所述第二数值插入所述第一随机数序列中的第M位数值所在的位置;inserting the second numerical value into the position of the Mth numerical value in the first random number sequence;

将所述第M位数值及第M位之后的数值往后移,得到所述第二随机数序列。The second random number sequence is obtained by moving the M-th numerical value and the numerical value after the M-th bit backward.

通过上述方法,得到当前权限开放状态对应的随机数序列,用户很难通过更改该随机数序列实现对当前权限对应的开放状态进行更改。Through the above method, the random number sequence corresponding to the current permission opening state is obtained, and it is difficult for the user to change the opening state corresponding to the current permission by changing the random number sequence.

在一种可能的设计中,在将所述第二随机数序列作为所述开放状态对应的第一指示标识之后,还包括:In a possible design, after using the second random number sequence as the first indicator corresponding to the open state, the method further includes:

获取所述开放状态对应的用户信息加密串;obtaining the encrypted string of user information corresponding to the open state;

将所述用户信息加密串与所述第二随机数序列进行组合,得到第二指示标识;combining the user information encrypted string and the second random number sequence to obtain a second indication;

将所述第二指示标识作为所述开放状态对应的最终指示标识。The second indicator is used as the final indicator corresponding to the open state.

通过上述方法,得到当前权限开放状态对应的最终指示标识,该指示标识中包含用户信息,实现每个用户的每个权限开放状态对应的指示标识都是唯一的,因此,避免最终指示标识在多个用户之间复用。Through the above method, the final indication mark corresponding to the current permission open state is obtained, and the indication mark contains user information, so that the indication mark corresponding to each authority open state of each user is unique. reuse between users.

第二方面,本申请提供了一种开关加密装置,所述装置包括:In a second aspect, the present application provides a switch encryption device, the device comprising:

第一确定模块,用于在包含多个随机数的第一随机数序列中确定出第一数值;a first determining module, configured to determine a first numerical value in a first random number sequence including a plurality of random numbers;

计算模块,用于根据当前权限对应的开放状态及所述第一数值,计算得到第二数值;a calculation module, configured to calculate and obtain the second numerical value according to the open state corresponding to the current authority and the first numerical value;

插入模块,用于将所述第二数值插入所述第一随机数序列中,得到第二随机数序列;an inserting module, configured to insert the second value into the first random number sequence to obtain a second random number sequence;

第二确定模块,用于将所述第二随机数序列作为所述开放状态对应的第一指示标识。The second determination module is configured to use the second random number sequence as the first indication identifier corresponding to the open state.

在一种可能的设计中,所述计算模块具体用于:In a possible design, the computing module is specifically used for:

检测所述当前权限对应的开放状态;detecting the open state corresponding to the current permission;

若所述当前权限为开启状态,则获取第一预设参数;If the current permission is in an open state, acquiring a first preset parameter;

将所述第一数值与所述第一预设参数输入预设计算模型,得到所述第二数值。Inputting the first numerical value and the first preset parameter into a preset calculation model to obtain the second numerical value.

在一种可能的设计中,所述计算模块具体用于:In a possible design, the computing module is specifically used for:

检测所述当前权限对应的开放状态;detecting the open state corresponding to the current permission;

若所述当前权限为关闭状态,则获取第二预设参数;If the current permission is in an off state, acquiring a second preset parameter;

将所述第一数值与所述第二预设参数输入预设计算模型,得到所述第二数值。Inputting the first value and the second preset parameter into a preset calculation model to obtain the second value.

在一种可能的设计中,所述插入模块具体用于:In a possible design, the plug-in module is specifically used to:

确定所述第一数值为M,其中,M为整数;Determine that the first numerical value is M, where M is an integer;

将所述第二数值插入所述第一随机数中的第M位数值所在的位置;inserting the second numerical value into the position of the Mth numerical value in the first random number;

将所述第M位数值及第M位之后的数值往后移,得到所述第二随机数序列。The second random number sequence is obtained by moving the M-th numerical value and the numerical value after the M-th bit backward.

在一种可能的设计中,所述装置还包括:In a possible design, the device further includes:

获取模块,用于获取所述开放状态对应的用户信息加密串;an obtaining module, configured to obtain the encrypted string of user information corresponding to the open state;

组合模块,用于将所述用户信息加密串与所述第二随机数序列进行组合,得到第二指示标识;a combining module, configured to combine the user information encrypted string and the second random number sequence to obtain a second indication mark;

第三确定模块,用于将所述第二指示标识作为所述开放状态对应的最终指示标识。A third determining module, configured to use the second indication identifier as the final indication identifier corresponding to the open state.

第三方面,本申请提供了一种电子设备,包括:In a third aspect, the present application provides an electronic device, comprising:

存储器,用于存放计算机程序;memory for storing computer programs;

处理器,用于执行所述存储器上所存放的计算机程序时,实现上述开关加密方法步骤。The processor is configured to implement the steps of the switch encryption method when executing the computer program stored in the memory.

第四方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现上述开关加密方法步骤。In a fourth aspect, the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the switch encryption method are implemented.

通过上述开关加密方法,将当前权限对应的开放状态设置成一个序列数,从而避免当前权限的开放状态被篡改,安全性高。Through the above switch encryption method, the open state corresponding to the current permission is set as a sequence number, thereby preventing the open state of the current permission from being tampered with, and the security is high.

上述第三方面至第六方面中的各个方面以及各个方面可能达到的技术效果参照上述针对第一方面、第二方面或者第一方面、第二方面中的各种可能方案可以达到的技术效果说明,这里不再重复赘述。Each of the above-mentioned third to sixth aspects and the possible technical effects achieved by each aspect are described with reference to the above-mentioned technical effects that can be achieved with respect to the first aspect, the second aspect, or various possible solutions in the first and second aspects. , which will not be repeated here.

附图说明Description of drawings

图1为本申请提供的一种开关加密方法的流程图;Fig. 1 is the flow chart of a kind of switch encryption method that this application provides;

图2为本申请提供的一种开关加密方法的实例图;2 is an example diagram of a switch encryption method provided by the application;

图3为本申请提供的一种开关装置的结构示意图;3 is a schematic structural diagram of a switch device provided by the application;

图4为本申请提供的一种电子设备结构示意图。FIG. 4 is a schematic structural diagram of an electronic device provided by the present application.

具体实施方式Detailed ways

为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述。方法实施例中的具体操作方法也可以应用于装置实施例或系统实施例中。需要说明的是,在本申请的描述中“多个”理解为“至少两个”。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。A与B连接,可以表示:A与B直接连接和A与B通过C连接这两种情况。另外,在本申请的描述中,“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. The specific operation methods in the method embodiments may also be applied to the apparatus embodiments or the system embodiments. It should be noted that, in the description of this application, "a plurality" is understood as "at least two". "And/or", which describes the association relationship of the associated objects, means that there can be three kinds of relationships, for example, A and/or B, which can mean that A exists alone, A and B exist at the same time, and B exists alone. A and B are connected, which can be expressed as two cases: A and B are directly connected and A and B are connected through C. In addition, in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing and describing, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

下面结合附图,对本申请实施例进行详细描述。The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

现有技术在实现对用户灵活开放特定功能权限时,通常利用配置文件或者数据表字段控制,比如,使用“1”或者“是”表示开放某一功能权限,使用“0”或者“否”表示关闭某一功能权限。如果用户知晓这种控制原理,极容易更改权限设置。In the prior art, when flexibly opening a specific function authority to a user, it is usually controlled by a configuration file or a data table field. For example, "1" or "Yes" is used to indicate that a certain function authority is opened, and "0" or "No" is used to indicate that a certain function authority is opened. Disable a function permission. If the user knows this control principle, it is very easy to change the permission settings.

为了解决上述问题,本申请提供了一种开关加密方法,将当前权限对应的开放状态设置成一个序列数,使得用户很难通过篡改随机序列数来改变当前权限的开放状态,安全性高。其中,本申请实施例所述方法和装置基于同一技术构思,由于方法及装置所解决问题的原理相似,因此,装置与方法的实施例可以相互参见,重复之处不再赘述。In order to solve the above problem, the present application provides a switch encryption method, which sets the open state corresponding to the current permission as a sequence number, so that it is difficult for the user to change the open state of the current permission by tampering with the random sequence number, and the security is high. The methods and devices described in the embodiments of the present application are based on the same technical concept. Since the principles of the problems solved by the methods and devices are similar, the embodiments of the devices and methods can be referred to each other, and repeated descriptions are not repeated here.

如图1所示,为本申请提供的一种开关加密方法的流程图,具体包括如下步骤:As shown in Figure 1, the flow chart of a kind of switch encryption method provided by this application specifically includes the following steps:

S11,在包含多个随机数的第一随机数序列中确定出第一数值;S11, determining a first numerical value in a first random number sequence containing multiple random numbers;

S12,根据当前权限对应的开放状态及第一数值,计算得到第二数值;S12, calculate and obtain the second value according to the open state corresponding to the current authority and the first value;

S13,将第二数值插入第一随机数序列中,得到第二随机数序列;S13, inserting the second value into the first random number sequence to obtain a second random number sequence;

S14,将第二随机数序列作为开放状态对应的第一指示标识。S14, using the second random number sequence as the first indication identifier corresponding to the open state.

在本申请实施例中,在生成包含多个随机数的第一随机数序列以后,在第一随机数序列中确定出第一数值,比如,若当前生成的第一随机数序列为[1,2,3,4,5],那么确定出的第一数值可以是1,当然也可以是2、3、4、5,此处不做具体限定。In this embodiment of the present application, after the first random number sequence including multiple random numbers is generated, the first value is determined in the first random number sequence. For example, if the currently generated first random number sequence is [1, 2, 3, 4, 5], then the determined first value may be 1, and certainly may be 2, 3, 4, and 5, which is not specifically limited here.

进一步,根据当前权限对应的开放状态及第一数值,计算得到第二数值。其中,开放状态包括开启状态和关闭状态。通常情况下,开启状态用“是”、“1”或者“on”等方式来表示,关闭状态用“否”、“0”或者“off”等方式来表示,这种表示权限开放状态的方式很容易被破解。Further, according to the open state corresponding to the current authority and the first value, the second value is obtained by calculation. The open state includes an open state and a closed state. Usually, the open state is represented by "yes", "1" or "on", and the off state is represented by "no", "0" or "off". It is easy to be cracked.

在本申请实施例中,若检测出当前权限为开启状态,则获取第一预设参数,并将第一数值与第一预设参数输入预设计算模型,得到第二数值,其中,预设计算模型可以是求和模型,也可以是求差模型,也可以是乘法模型,此处不做具体限定。举例来讲,当前权限对应的开放状态为开启状态,第一数值为1,将第一预设参数可以设置为0,预设计算模型为求和模型,此时得到的第二数值为1。In the embodiment of the present application, if it is detected that the current permission is in the open state, the first preset parameter is obtained, and the first value and the first preset parameter are input into the preset calculation model to obtain the second value, wherein the preset value is The calculation model may be a summation model, a difference model, or a multiplication model, which is not specifically limited here. For example, the open state corresponding to the current permission is the open state, the first value is 1, the first preset parameter can be set to 0, the preset calculation model is a summation model, and the second value obtained at this time is 1.

若检测出当前权限为关闭状态,则获取第二预设参数,并将第一数值与第二预设参数输入预设计算模型,得到第二数值。举例来讲,当前权限对应的开放状态为开启状态,第一数值为1,将第二预设参数可以设置为1,预设计算模型为求和模型,此时得到的第二数值为2。If it is detected that the current authority is in an off state, the second preset parameter is obtained, and the first value and the second preset parameter are input into the preset calculation model to obtain the second value. For example, the open state corresponding to the current permission is the open state, the first value is 1, the second preset parameter can be set to 1, the preset calculation model is a summation model, and the second value obtained at this time is 2.

进一步,将通过上述方法计算得到的第二数值插入第一随机数序列中,得到第二随机数序列,具体插入方法包括:确定第一数值为M,其中,M为整数;将第二数值插入第一随机数序列中的第M位数值所在的位置;将第M位数值及第M位之后的数值往后移,得到第二随机数序列。Further, inserting the second numerical value calculated by the above method into the first random number sequence to obtain a second random number sequence, the specific inserting method includes: determining the first numerical value as M, where M is an integer; inserting the second numerical value into The position where the Mth digit value in the first random number sequence is located; the Mth digit value and the value after the Mth digit are moved backward to obtain the second random number sequence.

举例来讲,第一随机数序列为[1,2,3,4,5],M等于2,第二数值为1时,那么将1插入第一随机数序列中的第二位数所在的位置,得到的第二随机数序列为[1,1,2,3,4,5]。同理,若第二数值为2时,将2插入第一随机数序列中的第二位数所在的位置,得到的第二随机数序列为[1,2,2,3,4,5]。For example, if the first random number sequence is [1, 2, 3, 4, 5], M is equal to 2, and the second value is 1, then insert 1 into the location of the second digit in the first random number sequence. position, the obtained second random number sequence is [1, 1, 2, 3, 4, 5]. Similarly, if the second value is 2, insert 2 into the position of the second digit in the first random number sequence, and the obtained second random number sequence is [1, 2, 2, 3, 4, 5] .

进一步,将通过上述方法得到的第二随机数序列作为开放状态对应的第一指示标识,可以避免用户对当前开放权限对应的开关状态进行更改,安全性高。Further, using the second random number sequence obtained by the above method as the first indication identifier corresponding to the open state can prevent the user from changing the switch state corresponding to the current open permission, and has high security.

进一步,为了唯一表示每个用户对应的每个权限开放状态,还可以将第二随机数序列与用户信息加密串进行组合,得到第二指示标识,具体组合方法包括:获取开放状态对应的用户信息加密串;将用户信息加密串与第二随机数序列进行组合,得到第二指示标识;将第二指示标识作为开放状态对应的最终指示标识。Further, in order to uniquely represent each authority open state corresponding to each user, the second random number sequence can also be combined with the encrypted string of user information to obtain a second indication identifier. The specific combination method includes: obtaining the user information corresponding to the open state. Encrypted string; combine the user information encrypted string with the second random number sequence to obtain a second indication mark; use the second indication mark as the final indication mark corresponding to the open state.

举例来讲,第二随机数序列为[1,2,2,3,4,5],当前权限开放状态对应的用户信息加密串为,那么将abc“abc”与第二随机数序列进行组合,可以得到的第二指示标识可以为“1,2,2,3,4,5,abc”。For example, the second random number sequence is [1, 2, 2, 3, 4, 5], and the user information encryption string corresponding to the current permission open state is, then combine abc "abc" with the second random number sequence , the available second indicator can be "1, 2, 2, 3, 4, 5, abc".

由于每个用户对应的信用信息加密串都是唯一的,因此,通过上述方法得到的第二指示标识可以唯一表示每个用户对应的每个权限开放状态,避免同一指示标识在多个用户之间复用。Since the encrypted string of credit information corresponding to each user is unique, the second indication identifier obtained by the above method can uniquely represent the open state of each permission corresponding to each user, so as to avoid the same indication identifier between multiple users. reuse.

进一步,为了更加详细阐述本申请实施例中的开关加密方法,下面以具体的应用场景对上述开放加密方法进行说明。Further, in order to describe the switch encryption method in the embodiments of the present application in more detail, the above-mentioned open encryption method is described below with a specific application scenario.

如图2所示,为对用户是否开通专票的开关进行加密表示的示意图。首先生成10位随机数序列,然后判断当前开关状态,若当前开关为“0”,则确定出10位随机数中的第一位数a,并将a插入10位随机数中的第a位,得到新的11位随机数;若当前开关状态为“1”,则确定出10位随机数中的第一位数a,并将a+1所得的数值插入10位随机数中的第a位,得到新的11位随机数。As shown in FIG. 2 , it is a schematic diagram of encrypting the switch for whether the user has opened a special ticket. First generate a 10-digit random number sequence, and then judge the current switch state. If the current switch is "0", determine the first digit a in the 10-digit random number, and insert a into the a-th digit of the 10-digit random number , get a new 11-bit random number; if the current switch state is "1", then determine the first digit a in the 10-digit random number, and insert the value obtained by a+1 into the a-th in the 10-digit random number bits to get a new 11-bit random number.

进一步,在新的11位随机数后附加用户信息加密串,得到新的数据,并将该数据作为用户权限开关状态对应个性化加密数据。Further, an encrypted string of user information is added to the new 11-digit random number to obtain new data, and the data is used as the user permission switch state corresponding to the personalized encrypted data.

通过上述方法,将当前权限对应的开关状态设置一个序列数,避免用户直接更改当前权限设置,同时通过绑定用户信息加密串,还能避免同一个序列数在多个用户之间复用。Through the above method, a sequence number is set for the switch state corresponding to the current permission, so as to prevent the user from directly changing the current permission setting, and at the same time, by binding the encrypted string of user information, the same sequence number can also be prevented from being reused among multiple users.

基于同一发明构思,本申请实施例中还提供了一种开关加密装置,如图3所示,为本申请中一种开关加密装置的结构示意图,该装置包括:Based on the same inventive concept, an embodiment of the present application also provides a switch encryption device, as shown in FIG. 3 , which is a schematic structural diagram of a switch encryption device in the present application, and the device includes:

第一确定模块31,用于在包含多个随机数的第一随机数序列中确定出第一数值;a first determination module 31, configured to determine a first numerical value in a first random number sequence containing a plurality of random numbers;

计算模块32,用于根据当前权限对应的开放状态及所述第一数值,计算得到第二数值;The calculation module 32 is used to calculate and obtain the second numerical value according to the open state corresponding to the current authority and the first numerical value;

插入模块33,用于将所述第二数值插入所述第一随机数序列中,得到第二随机数序列;an inserting module 33, configured to insert the second numerical value into the first random number sequence to obtain a second random number sequence;

第二确定模块34,用于将所述第二随机数序列作为所述开放状态对应的第一指示标识。The second determination module 34 is configured to use the second random number sequence as the first indicator corresponding to the open state.

在一种可能的设计中,所述计算模块32具体用于:In a possible design, the computing module 32 is specifically used for:

检测所述当前权限对应的开放状态;detecting the open state corresponding to the current permission;

若所述当前权限为开启状态,则获取第一预设参数;If the current permission is in an open state, acquiring a first preset parameter;

将所述第一数值与所述第一预设参数输入预设计算模型,得到所述第二数值。Inputting the first numerical value and the first preset parameter into a preset calculation model to obtain the second numerical value.

在一种可能的设计中,所述计算模块32具体用于:In a possible design, the computing module 32 is specifically used for:

检测所述当前权限对应的开放状态;detecting the open state corresponding to the current permission;

若所述当前权限为关闭状态,则获取第二预设参数;If the current permission is in an off state, acquiring a second preset parameter;

将所述第一数值与所述第二预设参数输入预设计算模型,得到所述第二数值。Inputting the first value and the second preset parameter into a preset calculation model to obtain the second value.

在一种可能的设计中,所述插入模块33具体用于:In a possible design, the plug-in module 33 is specifically used for:

确定所述第一数值为M,其中,M为整数;Determine that the first numerical value is M, where M is an integer;

将所述第二数值插入所述第一随机数中的第M位数值所在的位置;inserting the second numerical value into the position of the Mth numerical value in the first random number;

将所述第M位数值及第M位之后的数值往后移,得到所述第二随机数序列。The second random number sequence is obtained by moving the M-th numerical value and the numerical value after the M-th bit backward.

在一种可能的设计中,所述装置还包括:In a possible design, the device further includes:

获取模块,用于获取所述开放状态对应的用户信息加密串;an obtaining module, configured to obtain the encrypted string of user information corresponding to the open state;

组合模块,用于将所述用户信息加密串与所述第二随机数序列进行组合,得到第二指示标识;a combining module, configured to combine the user information encrypted string and the second random number sequence to obtain a second indication mark;

第三确定模块,用于将所述第二指示标识作为所述开放状态对应的最终指示标识。A third determining module, configured to use the second indication identifier as the final indication identifier corresponding to the open state.

通过上述开关加密装置,通过上述开关加密方法,将当前权限对应的开放状态设置成一个序列数,从而避免当前权限的开放状态被篡改,安全性高。同时,通过绑定用户信息加密串,还能避免同一个序列数在多个用户之间复用。Through the switch encryption device and the switch encryption method, the open state corresponding to the current authority is set as a sequence number, thereby preventing the open state of the current authority from being tampered with, and the security is high. At the same time, by binding the encrypted string of user information, it is also possible to avoid multiplexing of the same sequence number among multiple users.

基于同一发明构思,本申请实施例中还提供了一种电子设备,所述电子设备可以实现前述一种开关加密装置的功能,参考图4,所述电子设备包括:Based on the same inventive concept, an embodiment of the present application also provides an electronic device, which can implement the function of the foregoing switch encryption device. Referring to FIG. 4 , the electronic device includes:

至少一个处理器41,以及与至少一个处理器41连接的存储器42,本申请实施例中不限定处理器41与存储器42之间的具体连接介质,图4中是以处理器41和存储器42之间通过总线40连接为例。总线40在图4中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。总线40可以分为地址总线、数据总线、控制总线等,为便于表示,图4中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。或者,处理器41也可以称为控制器,对于名称不做限制。At least one processor 41 and a memory 42 connected to the at least one processor 41. The specific connection medium between the processor 41 and the memory 42 is not limited in the embodiments of the present application. Take the connection through the bus 40 as an example. The bus 40 is represented by a thick line in FIG. 4 , and the connection modes between other components are only for schematic illustration, and are not intended to be limiting. The bus 40 can be divided into an address bus, a data bus, a control bus, etc. For convenience of presentation, only one thick line is used in FIG. 4 , but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 41 may also be called a controller, and the name is not limited.

在本申请实施例中,存储器42存储有可被至少一个处理器41执行的指令,至少一个处理器41通过执行存储器42存储的指令,可以执行前文论述开关加密方法。处理器41可以实现图3所示的装置中各个模块的功能。In this embodiment of the present application, the memory 42 stores instructions that can be executed by at least one processor 41 , and the at least one processor 41 can execute the switch encryption method discussed above by executing the instructions stored in the memory 42 . The processor 41 can implement the functions of each module in the apparatus shown in FIG. 3 .

其中,处理器41是该装置的控制中心,可以利用各种接口和线路连接整个该控制设备的各个部分,通过运行或执行存储在存储器42内的指令以及调用存储在存储器42内的数据,该装置的各种功能和处理数据,从而对该装置进行整体监控。Among them, the processor 41 is the control center of the device, and can use various interfaces and lines to connect various parts of the entire control device, by running or executing the instructions stored in the memory 42 and calling the data stored in the memory 42, the Various functions and processing data of the device to monitor the device as a whole.

在一种可能的设计中,处理器41可包括一个或多个处理单元,处理器41可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器41中。在一些实施例中,处理器41和存储器42可以在同一芯片上实现,在一些实施例中,它们也可以在独立的芯片上分别实现。In a possible design, the processor 41 may include one or more processing units, and the processor 41 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface and application programs etc., the modem processor mainly deals with wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 41 . In some embodiments, the processor 41 and the memory 42 may be implemented on the same chip, and in some embodiments, they may be implemented separately on separate chips.

处理器41可以是通用处理器,例如中央处理器(CPU)、数字信号处理器、专用集成电路、现场可编程门阵列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件,可以实现或者执行本申请实施例中公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的开关加密方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。Processor 41 may be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application specific integrated circuit, field programmable gate array or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, may The methods, steps, and logic block diagrams disclosed in the embodiments of the present application are realized or executed. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the switch encryption method disclosed in conjunction with the embodiments of the present application may be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

存储器42作为一种非易失性计算机可读存储介质,可用于存储非易失性软件程序、非易失性计算机可执行程序以及模块。存储器42可以包括至少一种类型的存储介质,例如可以包括闪存、硬盘、多媒体卡、卡型存储器、随机访问存储器(Random Access Memory,RAM)、静态随机访问存储器(Static Random Access Memory,SRAM)、可编程只读存储器(Programmable Read Only Memory,PROM)、只读存储器(Read Only Memory,ROM)、带电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、磁性存储器、磁盘、光盘等。存储器42是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。本申请实施例中的存储器42还可以是电路或者其它任意能够实现存储功能的装置,用于存储程序指令和/或数据。The memory 42, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs and modules. The memory 42 may include at least one type of storage medium, for example, may include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Magnetic Memory, Disk , CD, etc. The memory 42 is, but is not limited to, any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory 42 in this embodiment of the present application may also be a circuit or any other device capable of implementing a storage function, for storing program instructions and/or data.

通过对处理器41进行设计编程,可以将前述实施例中介绍的开关加密方法所对应的代码固化到芯片内,从而使芯片在运行时能够执行图1所示的实施例的开关加密方法的步骤。如何对处理器41进行设计编程为本领域技术人员所公知的技术,这里不再赘述。By designing and programming the processor 41, the code corresponding to the switch encryption method introduced in the foregoing embodiment can be solidified into the chip, so that the chip can execute the steps of the switch encryption method of the embodiment shown in FIG. 1 during operation. . How to design and program the processor 41 is known to those skilled in the art, and details are not described here.

基于同一发明构思,本申请实施例还提供一种存储介质,该存储介质存储有计算机指令,当该计算机指令在计算机上运行时,使得计算机执行前文论述开关加密方法。Based on the same inventive concept, an embodiment of the present application further provides a storage medium, where computer instructions are stored in the storage medium, and when the computer instructions are executed on a computer, the computer executes the switch encryption method discussed above.

在一些可能的实施方式中,本申请提供的开关加密方法的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当程序产品在装置上运行时,程序代码用于使该控制设备执行本说明书上述描述的根据本申请各种示例性实施方式的开关加密方法中的步骤。In some possible implementations, various aspects of the switch encryption method provided by the present application can also be implemented in the form of a program product, which includes program code, and when the program product runs on the device, the program code is used to make the control The device performs the steps in the switch encryption method according to various exemplary embodiments of the present application described above in this specification.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by those skilled in the art, the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程开关加密设备的处理器以产生一个机器,使得通过计算机或其他可编程开关加密设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable switch encryption device to produce a machine such that the instructions executed by the processor of the computer or other programmable switch encryption device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程开关加密设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable switch cryptographic device to operate in a particular manner, such that the instructions stored in the computer readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

这些计算机程序指令也可装载到计算机或其他可编程开关加密设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable switch encryption device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that a computer implemented on the computer or other programmable device The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.

显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims (10)

1. A switch encryption method, the method comprising:
determining a first value in a first random number sequence comprising a plurality of random numbers;
calculating to obtain a second numerical value according to the open state corresponding to the current authority and the first numerical value;
inserting the second numerical value into the first random number sequence to obtain a second random number sequence;
and taking the second random number sequence as a first indication identifier corresponding to the open state.
2. The method of claim 1, wherein the calculating a second value according to the open state corresponding to the current permission and the first value comprises:
detecting an open state corresponding to the current authority;
if the current authority is in an open state, acquiring a first preset parameter;
and inputting the first numerical value and the first preset parameter into a preset calculation model to obtain the second numerical value.
3. The method of claim 1, wherein the calculating a second value according to the open state corresponding to the current permission and the first value comprises:
detecting an open state corresponding to the current authority;
if the current authority is in a closed state, acquiring a second preset parameter;
and inputting the first numerical value and the second preset parameter into a preset calculation model to obtain the second numerical value.
4. The method of claim 1, wherein said inserting the second value into the first sequence of random numbers to obtain a second sequence of random numbers comprises:
determining the first value to be M, wherein M is an integer;
inserting the second numerical value into the position of the Mth numerical value in the first random number sequence;
and moving the value of the M bit and the value behind the M bit backwards to obtain the second random number sequence.
5. The method of claim 1, wherein after taking the second sequence of random numbers as the first indicator corresponding to the open state, further comprising:
acquiring a user information encryption string corresponding to the open state;
combining the user information encryption string with the second random number sequence to obtain a second indication identifier;
and taking the second indication mark as a final indication mark corresponding to the open state.
6. A switch encryption apparatus, the apparatus comprising:
a first determining module for determining a first value in a first random number sequence comprising a plurality of random numbers;
the calculation module is used for calculating to obtain a second numerical value according to the open state corresponding to the current authority and the first numerical value;
the inserting module is used for inserting the second numerical value into the first random number sequence to obtain a second random number sequence;
and the second determining module is used for taking the second random number sequence as the first indication identifier corresponding to the open state.
7. The apparatus of claim 6, wherein the insertion module is specifically configured to:
determining the first value to be M, wherein M is an integer;
inserting the second numerical value into the position of the Mth numerical value in the first random number sequence;
and moving the value of the M bit and the value behind the M bit backwards to obtain the second random number sequence.
8. The apparatus of claim 6, wherein the apparatus further comprises:
the acquisition module is used for acquiring the user information encryption string corresponding to the open state;
the combination module is used for combining the user information encryption string with the second random number sequence to obtain a second indication identifier;
and the third determining module is used for taking the second indication mark as a final indication mark corresponding to the open state.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1-5 when executing the computer program stored on the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1-5.
CN202111609934.1A 2021-12-27 2021-12-27 Switch encryption method and device and electronic equipment Pending CN114386062A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111609934.1A CN114386062A (en) 2021-12-27 2021-12-27 Switch encryption method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111609934.1A CN114386062A (en) 2021-12-27 2021-12-27 Switch encryption method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN114386062A true CN114386062A (en) 2022-04-22

Family

ID=81198439

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111609934.1A Pending CN114386062A (en) 2021-12-27 2021-12-27 Switch encryption method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114386062A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110493207A (en) * 2019-08-06 2019-11-22 北京达佳互联信息技术有限公司 A kind of data processing method, device, electronic equipment and storage medium
CN113314187A (en) * 2021-05-27 2021-08-27 广州大学 Data storage method, decoding method, system, device and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110493207A (en) * 2019-08-06 2019-11-22 北京达佳互联信息技术有限公司 A kind of data processing method, device, electronic equipment and storage medium
CN113314187A (en) * 2021-05-27 2021-08-27 广州大学 Data storage method, decoding method, system, device and storage medium

Similar Documents

Publication Publication Date Title
US6961852B2 (en) System and method for authenticating software using hidden intermediate keys
CN100464313C (en) Mobile memory device and method for accessing encrypted data in mobile memory device
Foster et al. Surface critical exponents for models of polymer collapse and adsorption: the universality of the Theta and Theta'points
CN102165407B (en) Redundant array of independent disks-related operations
CN107609416A (en) Safe encryption method, system, computer installation and the computer-readable recording medium of user data
CN109388966A (en) File permission control method and device
CN103164660B (en) The system whether authentication string is accepted by automatic machine
CN114386058A (en) Model file encryption and decryption method and device
SE521072C2 (en) Security system and process against illegal use or copying of electronic data
US6898555B2 (en) Method for indicating the integrity of use-information of a computer program
CN114386062A (en) Switch encryption method and device and electronic equipment
CN113806776A (en) Block chain-based medical archive query method and device, electronic equipment and medium
KR101624387B1 (en) Method for software asset management based on software birthmark and apparatus thereof
CN110032529B (en) Memory management method and related device
CN114239028B (en) A data processing method, device, computer equipment and storage medium
CN108363912A (en) A kind of close guarantor's method and device of program code
CN101403985A (en) Software permission backup method for software protection apparatus
CN111639353B (en) Data management method and device, embedded equipment and storage medium
CN112307491B (en) Character display method, device, electronic device and computer readable storage medium
CN113987580A (en) Block chain data access method, device, equipment and medium based on user attributes
CN115640587A (en) Signature method, signature verification method and device of ELF file based on linux system
CN114385221A (en) Version management method and device and electronic equipment
CN112613058A (en) Method and device for retrieving encryption key, electronic equipment and storage medium
CN107634826B (en) Encryption method and system based on ZYNQ device
CN109308420B (en) Data encryption method, terminal equipment and computer readable storage medium

Legal Events

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