TWI757694B - Method of generating true random numbers based on quantum computing - Google Patents
Method of generating true random numbers based on quantum computing Download PDFInfo
- Publication number
- TWI757694B TWI757694B TW109105753A TW109105753A TWI757694B TW I757694 B TWI757694 B TW I757694B TW 109105753 A TW109105753 A TW 109105753A TW 109105753 A TW109105753 A TW 109105753A TW I757694 B TWI757694 B TW I757694B
- Authority
- TW
- Taiwan
- Prior art keywords
- random number
- quantum
- qubit
- classical
- random
- Prior art date
Links
Images
Abstract
Description
本發明係與量子運算有關,特別有關於基於量子運算的真亂數產生方法。 The present invention is related to quantum operations, and particularly relates to a method for generating true random numbers based on quantum operations.
現有的亂數產生方法多是採用模擬亂數(pseudo random)技術。上述模擬亂數技術是先設定亂數種子(seed),並基於亂數種子來執行亂數演算法,以產生亂數值。 Most of the existing random number generation methods use pseudo random technology. The above simulation random number technology is to set a random number seed (seed) first, and execute a random number algorithm based on the random number seed to generate a random number.
現有的亂數產生方法由於使用固定的亂數種子與亂數演算法來產生亂數,其所產生的多個亂數值之間實際上存在規律,而可被預測與重複。 Since the existing random number generation method uses a fixed random number seed and a random number algorithm to generate random numbers, there is actually a law among the generated random numbers, which can be predicted and repeated.
更進一步地,當亂數值可以被預測或重複時,基於亂數值的應用(如加解密或博奕遊戲)將存在被破解的風險。 Furthermore, when the random value can be predicted or repeated, the application based on the random value (such as encryption and decryption or casino games) will be at risk of being cracked.
是以,現有的模擬亂數產生方法存在上述問題,而亟待更有效的方案被提出。 Therefore, the existing methods for generating analog random numbers have the above problems, and more effective solutions are urgently needed.
本發明之主要目的,係在於提供一種基於量子運算的真亂數產生方法,可產生真亂數。 The main purpose of the present invention is to provide a method for generating true random numbers based on quantum operations, which can generate true random numbers.
為達上述目的,本發明係提供一種基於量子運算的真亂數產生方法,包括以下步驟:a)於電腦設備經由網路自量子電腦接收經由對多個量子位元執行量測所獲得的多個古典位元;b)將多個古典位元儲存於電腦設備的儲存模組;c)基於亂數請求的亂數範圍自儲存模組讀取對應長度的多個古典位元作為亂數數列,並自儲存模組刪除所讀取的多個古典位元;d)對亂數數列執行格式轉換處理以獲得亂數值;及,e)輸出亂數值。 In order to achieve the above-mentioned object, the present invention provides a method for generating true random numbers based on quantum operations, comprising the following steps: a) receiving multiple data obtained by performing measurements on multiple qubits from a quantum computer via a network in a computer device; b) store a plurality of classical bits in the storage module of the computer device; c) read a plurality of classical bits of corresponding length from the storage module based on the random number range requested by the random number as a random number sequence , and delete a plurality of classical bits read from the storage module; d) perform format conversion processing on the random number sequence to obtain random values; and, e) output random values.
本發明可有效產生無法預測且不具重複性的真亂數,而可提升亂數應用的可信度。 The present invention can effectively generate unpredictable and non-repetitive real random numbers, and can improve the reliability of random number applications.
1:電腦設備 1: Computer equipment
100:處理模組 100: Processing modules
101:網路模組 101: Network Modules
102:人機介面 102: Human Machine Interface
103:儲存模組 103: Storage Module
1030:亂數產生程式 1030: Random Number Generation Program
1031:古典位元緩衝區 1031: Classical bit buffer
104:功能模組 104: Function module
2:量子電腦 2: Quantum Computer
20:雲端應用平台 20: Cloud Application Platform
200:量子電腦程式 200: Quantum Computer Program
3:網路 3: Internet
4:外部電腦設備 4: External computer equipment
50-52、70:Hadamard邏輯閘 50-52, 70: Hadamard logic gate
60-62、83:量測邏輯閘 60-62, 83: measurement logic gate
7、8:量子邏輯電路 7, 8: Quantum logic circuits
71、72、81:單控制反邏輯閘 71, 72, 81: single control inverse logic gate
80、82:雙控制反邏輯閘 80, 82: double control inverse logic gate
S10-S14:第一亂數產生步驟 S10-S14: The first random number generation step
S20-S22:忽略誤差量測步驟 S20-S22: Ignore error measurement steps
S30-S32、S40-S43:考量誤差量測步驟 S30-S32, S40-S43: Considering the error measurement steps
S50-S59:第二亂數產生步驟 S50-S59: the second random number generating step
S60-S64:第三亂數產生步驟 S60-S64: The third random number generation step
S70-S72:第四亂數產生步驟 S70-S72: Fourth random number generation step
S80-S81:亂數應用步驟 S80-S81: Random number application steps
圖1為本發明一實施態樣的真亂數產生系統的架構圖。 FIG. 1 is a structural diagram of a true random number generation system according to an embodiment of the present invention.
圖2為本發明第一實施例的真亂數產生方法的流程圖。 FIG. 2 is a flowchart of a method for generating a true random number according to the first embodiment of the present invention.
圖3為本發明第二實施例的真亂數產生方法的部分流程圖。 FIG. 3 is a partial flowchart of a method for generating a true random number according to a second embodiment of the present invention.
圖4為本發明第三實施例的真亂數產生方法的部分流程圖。 FIG. 4 is a partial flowchart of a method for generating a true random number according to a third embodiment of the present invention.
圖5為本發明第四實施例的真亂數產生方法的流程圖。 FIG. 5 is a flowchart of a method for generating a true random number according to a fourth embodiment of the present invention.
圖6為本發明第五實施例的真亂數產生方法的部分流程圖。 FIG. 6 is a partial flowchart of a method for generating a true random number according to a fifth embodiment of the present invention.
圖7為本發明第六實施例的真亂數產生方法的部分流程圖。 FIG. 7 is a partial flowchart of a method for generating a true random number according to a sixth embodiment of the present invention.
圖8為本發明第七實施例的真亂數產生方法的部分流程圖。 FIG. 8 is a partial flowchart of a method for generating a true random number according to a seventh embodiment of the present invention.
圖9為本發明一實施態樣的量子邏輯電路的架構圖。 FIG. 9 is a structural diagram of a quantum logic circuit according to an embodiment of the present invention.
圖10為本發明一實施態樣的量子邏輯電路的架構圖。 FIG. 10 is a structural diagram of a quantum logic circuit according to an embodiment of the present invention.
茲就本發明之數個較佳實施方式,配合圖式,詳細說明如後。 Hereinafter, several preferred embodiments of the present invention will be described in detail in conjunction with the drawings.
目前大部分的電腦設備都是採用古典位元(classical binary bits)作為運算或儲存的最小資料單位。古典位元僅能被設定為0與1的其中之一。 At present, most computer equipments use classical binary bits as the smallest data unit for operation or storage. Classical bits can only be set to one of 0 and 1.
相較於古典位元,量子位元(Qubit)是以向量來加以描述,在運算過程中量子態可以是0也可以是1,而必須經過量測才能獲得確定的量子態(如0或1)。並且,當量子位元處於疊加態(superposition)時,為0的機率與為1的機率皆為50%。 Compared with classical bits, quantum bits (Qubits) are described by vectors, and the quantum state can be 0 or 1 during the operation process, and a definite quantum state (such as 0 or 1) can only be obtained after measurement. ). Also, when the qubit is in a superposition, the probability of being 0 and the probability of being 1 are both 50%.
具體而言,古典位元與量子位元主要具有以下區別: Specifically, classical bits and qubits mainly have the following differences:
一、量子位元的量子態是歸一化(Normalized)的向量來加以描述,可用抽象的狄拉克標記(Dirac Notation)來加以表示,即|0〉與|1〉;古典位元則是以數值0或1來加以描述。 1. The quantum state of a qubit is described by a normalized vector, which can be represented by an abstract Dirac Notation, namely |0> and |1>; classical bits are represented by A value of 0 or 1 is used to describe it.
二、因為量子態是向量,單一量子位元可以處於|0〉與|1〉的線性疊加;古典位元則無法以疊加態描述。 Second, because the quantum state is a vector, a single qubit can be in a linear superposition of |0> and |1>; a classical bit cannot be described by a superposition state.
三、當多個量子位元彼此有交互作用時,則處於量子糾纏態,即其中一個量子位元狀態改變時,會瞬間影響另一個量子位元;多個古典位元之間則彼此獨立,沒有交互作用。 3. When multiple qubits interact with each other, they are in a state of quantum entanglement, that is, when the state of one qubit changes, it will instantly affect the other qubit; multiple classical bits are independent of each other, There is no interaction.
四、量子位元的量測結果與所選擇的量測基底有關,量測基底可以影響量測結果各個量測結果(量子態)的機率;古典位元則不需進行量測。更進一步地,目前已有相關技術提出:經由採用適當的量測基底,來使量子位元的不同量測結果(如0與1)具有相同的機率,即可隨機產生0與1。並且,前述使量子位元的不同量測結果具有相同的機率屬於量子運算領域的常見技術,於此不再贅述。 Fourth, the measurement results of qubits are related to the selected measurement substrate, and the measurement substrate can affect the probability of each measurement result (quantum state) of the measurement result; the classical bit does not need to be measured. Furthermore, it has been proposed in the related art that 0 and 1 can be randomly generated by using an appropriate measurement substrate so that different measurement results (eg, 0 and 1) of the qubit have the same probability. In addition, the above-mentioned making different measurement results of qubits have the same probability is a common technique in the field of quantum computing, and will not be repeated here.
首請參閱圖1,為本發明一實施態樣的真亂數產生系統的架構圖。 First, please refer to FIG. 1 , which is a structural diagram of a real random number generation system according to an embodiment of the present invention.
為解決現有的模擬亂數可被預測與重複的問題,本發明是提出一種真亂數產生方法,是運用於圖1所示的真亂數產生系統。本發明的真亂數產生方法可基於量子運算來產生隨機的古典位元,以產生真亂數。並且,由於量子位元的量測結果具有真實隨機性,即不可被預測與重複,其量測結果可以用來產生真亂數。 In order to solve the problem that the existing analog random numbers can be predicted and repeated, the present invention proposes a real random number generation method, which is applied to the true random number generation system shown in FIG. 1 . The true random number generation method of the present invention can generate random classical bits based on quantum operations to generate true random numbers. Moreover, since the measurement results of qubits are truly random, that is, unpredictable and repeatable, the measurement results can be used to generate real random numbers.
具體而言,本發明的真亂數產生系統主要包括電腦設備1與至少一台量子電腦2(圖1以多台量子電腦2為例)。
Specifically, the true random number generation system of the present invention mainly includes a
電腦設備1為通用電腦(如智慧型手機、筆記型電腦、平板電腦、個人電腦、智慧型穿戴設備等等電子電腦或傳統電腦),主要是由大量積體電路組成,並用以基於古典位元(0與1)執行運算與資料儲存。
各量子電腦2是基於量子位元執行運算與資料儲存。量子電腦2是屬於量子運算領域的常見電腦設備,其細節架構與運作原理於此不再贅述。
Each
於一實施態樣中,量子電腦2是作為雲端伺服器,來經由量子運算提供指定的雲端服務。具體而言,量子電腦2可包括雲端應用平台20,雲端應用平台20可用來執行用以實現量子演算法的量子電腦程式200,藉以提供前述雲端服務(如經由量子演算法產生隨機的古典位元)。
In one embodiment, the
電腦設備1主要包括網路模組101、人機介面102、儲存模組103及電性連接上述模組的處理模組100。
The
網路模組101(如行動網路模組或Wi-Fi網路模組等等)用以連接網路3(如網際網路),並可透過網路3連接遠端的量子電腦2以進行資料傳輸(如請求/接收隨機的古典位元)。
The network module 101 (such as a mobile network module or a Wi-Fi network module, etc.) is used to connect to the network 3 (such as the Internet), and can connect to the
人機介面102可包含輸入裝置(如鍵盤、滑鼠及/或觸控板等等)與輸出裝置(如喇叭、指示燈及/或顯示器等等),並用來與用戶進行互動(如呈現後述的亂數值)。
The human-
儲存模組103可包括暫態電腦可讀取媒體(如RAM)與非暫態電腦可讀取媒體(如ROM、快閃記憶體、固態硬碟、磁碟硬碟等等),並用以儲存資料。
The
於一實施態樣中,非暫態電腦可讀取媒體可包括亂數產生程式1030。電腦程式1030記錄有電腦可執行之程式碼,當處理模組100執行前述程式碼後,可執行後述的本發明各實施例的真亂數產生方法。
In one embodiment, the non-transitory computer-readable medium may include the
於一實施態樣中,儲存模組103更包括一古典位元緩衝區(buffer)1031。古典位元緩衝區1031可為暫態電腦可讀取媒體或非暫態電腦可讀取媒體,不加以限定,並用以儲存自量子電腦2所收到的古典位元。
In one embodiment, the
處理模組100(如CPU、MCU、GPU或其他處理器)用以控制電腦設備1的各模組運作。
The processing module 100 (eg, CPU, MCU, GPU or other processors) is used to control the operation of each module of the
於一實施態樣中,電腦設備1更包括一或多個功能模組104(圖1以一個功能模組104為例)。功能模組104電性連接處理模組100,用以實現特定功能。
In one embodiment, the
舉例來說,當功能模組104為照相機時,可拍攝所在環境的影像並提供給處理模組100進行處理;當功能模組104為人員偵測器(如PIR感測器)時,可偵測人員是否進入所在環境;當功能模組104為博弈機台時,可依據處理模組100所提供的資料(如亂數值)進行運作;當功能模組104為安全模組(如加/解密模組或驗證模組)時,可對資料進行加/解密或驗證。
For example, when the
於一實施態樣中,真亂數產生系統更包括外部電腦設備4。外部電腦設備4(如博弈機台、具有加/解密功能的儲存裝置或加/解密裝置等等)為通用電腦並連接網路3。外部電腦設備4可經由網路3自電腦設備1取得資料(如控制指令
或亂數值),並依據所收到的資料進行運轉(如產生博弈結果、執行資料加/解密,等等)。
In one embodiment, the real random number generation system further includes an
請一併參閱圖2,為本發明第一實施例的真亂數產生方法的流程圖。本實施例的真亂數產生方法包括以下步驟。 Please also refer to FIG. 2 , which is a flowchart of a method for generating a true random number according to the first embodiment of the present invention. The method for generating a true random number in this embodiment includes the following steps.
步驟S10:電腦設備1的處理模組100控制網路模組101經由網路3自量子電腦2接收多個古典位元。具體而言,量子電腦2可對多個量子位元執行量測來獲得隨機產生的多個古典位元,並將這些古典位元傳送至電腦設備1。
Step S10 : the
步驟S11:處理模組100將所收到的多個古典位元儲存於儲存模組103的古典位元緩衝區1031。
Step S11 : the
步驟S12:處理模組100基於亂數請求的亂數範圍(如1至10,或-100至-100等等)自儲存模組103的古典位元緩衝區1031讀取對應長度的多個古典位元作為亂數數列,並自古典位元緩衝區1031刪除所讀取的多個古典位元,即刪除已使用的古典位元。
Step S12: The
步驟S13:處理模組100對亂數數列執行格式轉換處理以獲得亂數值。
Step S13: The
於一實施例中,處理模組100依據亂數請求所要求的亂數格式(如1補數(1's complement)、2補數(2's complement)、十進位或十六進位等等)對亂數數列執行格式轉換,以產生格式相符的亂數值。
In one embodiment, the
於一實施例中,處理模組100是直接將亂數數列自二進位轉換進位
In one embodiment, the
步驟S14:處理模組100輸出亂數值。具體而言,處理模組100可經由人機介面102顯示亂數值、讀出亂數值,或者,經由網路模組101與網路3將亂數值傳送至外部電腦設備4,不加以限定。
Step S14: The
藉此,本發明可有效產生無法預測且不具重複性的真亂數,而可提升亂數應用的可信度。 In this way, the present invention can effectively generate unpredictable and non-repetitive real random numbers, and can improve the reliability of random number applications.
於一例子中,若亂數請求是要求0至127(亂數範圍)之間的五個亂數(亂數數量),則處理模組100是自古典位元緩衝區1031每次讀取8個古典位元(8位元可表示十進位的0至127的所有正整數)作為一個亂數數列以計算一個亂數值,並執行五次前述讀取與計算(共40位元)以獲得五個亂數值。
In an example, if the random number request requires five random numbers (number of random numbers) between 0 and 127 (random number range), the
於另一例子中,若亂數請求是要求-4至+4(亂數範圍)之間的1個亂數(亂數數量),則處理模組100是自古典位元緩衝區1031讀取4個古典位元作為亂數數列(4位元可表示十進位的-7至+7的所有整數值)以計算一個亂數值,並於亂數值超出亂數範圍時(如為-5或6),再次執行讀取與計算,直到所獲得的亂數值滿足亂數範圍。
In another example, if the random number request is for a random number (number of random numbers) between -4 and +4 (random number range), the
於一實施例中,古典位元緩衝區1031是一個先進先出(First In First out)的記憶體(如暫存器(register)、緩衝器(buffer)或快閃記憶體(flash memory)等等),步驟S11是以先進先出的方式來儲存多個古典位元至古典位元緩衝區1031,而步驟S12是以先進先出的方式來自古典位元緩衝區1031讀取多個古典位元。換句話說,最早被存入的古典位元緩衝區1031的古典位元(組)會最早被讀出。
In one embodiment, the
於一實施例中,電腦設備1可不斷重複執行步驟S10-S11來填滿古典位元緩衝區1031。藉此,當電腦設備1收到亂數請求時,可直接執行步驟S12-S14來輸出亂數值,而可節省步驟S10-S11的等待時間。
In one embodiment, the
於一實施例中,電腦設備1是於收到亂數請求時,才執行步驟S10-S11以取得隨機的古典位元,並接著執行步驟S12-S14以輸出亂數值。
In one embodiment, the
續請一併參閱圖1至圖3,圖3為本發明第二實施例的真亂數產生方法的部分流程圖。圖3是用以對圖2的步驟S10做更詳盡的說明。 Please refer to FIG. 1 to FIG. 3 together. FIG. 3 is a partial flowchart of a method for generating a true random number according to a second embodiment of the present invention. FIG. 3 is used to describe step S10 of FIG. 2 in more detail.
於本實施例中,為提升量子位元的量測效率,是直接忽略量子電腦的誤差,而直接進行量測並使用量測結果來產生亂數值。 In this embodiment, in order to improve the measurement efficiency of the qubit, the error of the quantum computer is directly ignored, and the measurement is directly performed and the measurement result is used to generate a random value.
具體而言,步驟S10可包括以下步驟S20-S22。 Specifically, step S10 may include the following steps S20-S22.
步驟S20:量子電腦2對各量子位元分別執行Hadamard邏輯閘操作以使各量子位元變為疊加態。Hadamard邏輯閘操作為量子運算領域的常見技術,主要是用以將量子位元變為為疊加態(即處於|0〉與|1〉的線性疊加),其計算細節於此不再贅述。
Step S20 : the
步驟S21:量子電腦2對疊加態的各量子位元分別執行量測處理以量測各量子位元的量子態來獲得一個古典位元。藉由對多個量子位元分別執行量測,量子電腦2可產生多個古典位元。
Step S21: The
於一實施例中,為了獲得較佳的執行效率,量子電腦2每次是對三個量子位元分別執行量測來獲得三個古典位元,但不以此限定,亦可對五個量子位元分別執行量測來獲得五個古典位元,等等。
In an embodiment, in order to obtain better execution efficiency, the
步驟S22:量子電腦2經由網路3傳送所獲得的多個古典位元至電腦設備1。
Step S22 : the
藉此,本發明可有效自量子位元經由量測獲得古典位元。 Thus, the present invention can effectively obtain classical bits from qubits through measurement.
請一併參閱圖9,為本發明一實施態樣的量子邏輯電路的架構圖。前述步驟S20-S21可使用圖9所示的量子邏輯電路來加以表示。更進一步地,前述量子電腦程式200可用來實現圖9所示的量子邏輯電路。
Please also refer to FIG. 9 , which is a structural diagram of a quantum logic circuit according to an embodiment of the present invention. The aforementioned steps S20-S21 can be represented by the quantum logic circuit shown in FIG. 9 . Furthermore, the aforementioned
於圖9的例子中,是對三個量子位元q0-q2進行量測,來獲得三筆量測結果(C),即三個古典位元。 In the example of FIG. 9, three qubits q0-q2 are measured to obtain three measurement results (C), namely, three classical bits.
具體而言,於本例子中,三個量子位元q0-q2是先分別通過Hadamard邏輯閘50-52來變為疊加態。接著,通過量測邏輯閘60-62對疊加態的三個量子位元q0-q2的量子態進行量測,以自量子位元q0獲得第零古典位元、自量子位元q1獲得第一古典位元、並自量子位元q2獲得第二古典位元(即控制線C的輸出)。 Specifically, in this example, the three qubits q0-q2 first pass through the Hadamard logic gates 50-52 to become superposition states. Next, the quantum states of the three qubits q0-q2 in the superposition state are measured by the measurement logic gates 60-62, so as to obtain the zeroth classical bit from the qubit q0 and obtain the first classical bit from the qubit q1 A classical bit, and a second classical bit (ie, the output of control line C) is obtained from qubit q2.
請一併參閱圖1、圖2及圖4,圖4為本發明第三實施例的真亂數產生方法的部分流程圖。圖4是用以對圖2的步驟S10做更詳盡的說明。 Please refer to FIG. 1 , FIG. 2 and FIG. 4 together. FIG. 4 is a partial flowchart of a method for generating a true random number according to a third embodiment of the present invention. FIG. 4 is used to describe step S10 of FIG. 2 in more detail.
量子位元容易受外界干擾(如熱雜訊)而產生誤差(如位元翻轉誤差,bit-flip error,如量子態|0〉受干擾而變成|1〉),而造成降低量測結果的品質。 Qubits are susceptible to external disturbances (such as thermal noise), resulting in errors (such as bit flip errors, bit-flip errors, such as quantum state |0> being disturbed and becoming |1>), which will reduce the measurement results. quality.
對此,於本實施例中,為排除上述誤差的影響,是將多個量子位元(做為區別,下稱工作量子位元)作為量子位元組(如兩個工作量子位元為一組量子位元組,或者五個工作量子位元為一組量子位元組),不加以限定),並對各量子位元組來執行量測以獲得一個古典位元(即本實施例是以多個量子位元來產生一個古典位元),來提升量測結果的品質。 In this regard, in this embodiment, in order to eliminate the influence of the above errors, a plurality of qubits (as a distinction, hereinafter referred to as working qubits) are used as a qubit group (for example, two working qubits are one set of qubits, or five working qubits as a set of qubits), without limitation), and perform measurements on each qubit to obtain a classical bit (that is, this embodiment is use multiple qubits to generate a classical bit) to improve the quality of the measurement results.
具體而言,步驟S10可包括以下步驟S30-S32。 Specifically, step S10 may include the following steps S30-S32.
步驟S30:量子電腦2使量子位元組的多個工作量子位變為糾纏態。於糾纏態下,多個工作量子位元的量子態會相互影響。
Step S30: The
並且,於沒有誤差的情況下,多個工作量子位元的量子態會因相互影響而相同。於存在位元翻轉誤差的情況下,其中一個(或以上)的工作量子位元的量子態會因翻轉而與其他工作量子位元的量子態不同。 And, in the absence of error, the quantum states of multiple working qubits will be the same due to mutual influence. In the presence of a bit flip error, the quantum state of one (or more) working qubits can be flipped to be different from the quantum states of the other working qubits.
步驟S31:量子電腦2依據糾纏態的多個工作量子位元的多個量子態決定一個古典位元。
Step S31: The
於一實施例中,是量測糾纏態的多個工作量子位元的多個量子態,依據多個量子態採用多數決來決定古典位元。舉例來說,若三個工作量子位元經量測的量子態分別為0、0、1,則基於多數決,古典位元會被設定為0(多數)。上述原理在於,量子位元發生誤差的機率是小於正常狀態的機率。 In one embodiment, a plurality of quantum states of a plurality of working qubits in an entangled state are measured, and a majority vote is used to determine a classical bit according to the plurality of quantum states. For example, if the measured quantum states of the three working qubits are 0, 0, and 1, the classical bit is set to 0 (majority) based on a majority vote. The above principle is that the probability of error in the qubit is smaller than the probability of the normal state.
於一實施例中,各量子位元組除了多個工作量子位元外,更包括輔助量子位元作為誤差校正碼(error correcting code)。 In one embodiment, in addition to a plurality of working qubits, each qubit group further includes auxiliary qubits as error correcting codes.
值得一提的是,經發明人的反覆實驗,三個工作量子位元可以具有最佳的糾纏態,而可以用來產生最佳的量測結果。對此,後續說明是以三個工作量子位元為例,但不應以此限定本發明的量子位元組的多個工作量子位元的數量(亦可為二個、五個或九個等等)。 It is worth mentioning that, after repeated experiments by the inventors, the three working qubits can have the best entangled state and can be used to produce the best measurement results. In this regard, the following description takes three working qubits as an example, but this should not limit the number of multiple working qubits in the qubit group of the present invention (it can also be two, five or nine). and many more).
具體而言,本實施例的步驟S31可包括步驟S40-S43。步驟S40:量子電腦2對第一個工作量子位元、第二個工作量子位元及輔助量子位元執行雙控制反邏輯閘操作,以影響輔助量子位元的量子態。
Specifically, step S31 in this embodiment may include steps S40-S43. Step S40: The
步驟S41:量子電腦2對第一個工作量子位元及第二個工作量子位元執行單控制反邏輯閘操作,以影響第二工作量子位元的量子態。
Step S41: The
步驟S42:量子電腦2對第二個工作量子位元、第三個工作量子位元及輔助量子位元執行雙控制反邏輯閘操作,以再次影響輔助量子位元的量子態。
Step S42: The
步驟S43:量子電腦2對輔助量子位元的量子態執行量測處理以獲得一個古典位元。
Step S43: The
接著,執行步驟S32:量子電腦2經由網路3傳送所獲得的一個古典位元至電腦設備1。
Next, step S32 is performed: the
藉此,本發明可有效校正量子位元的誤差,而提升量子位元的隨機性,並獲得品質更好的隨機數。 Thereby, the present invention can effectively correct the error of the qubit, improve the randomness of the qubit, and obtain a random number with better quality.
請一併參閱圖10,為本發明一實施態樣的量子邏輯電路的架構圖。圖4的步驟S30可使用圖10所示的量子邏輯電路7來加以實現,步驟S40-S43可使用圖10所示的量子邏輯電路8來加以實現。更進一步地,前述量子電腦程式200可用來實現圖10所示的量子邏輯電路7、8。
Please also refer to FIG. 10 , which is a structural diagram of a quantum logic circuit according to an embodiment of the present invention. Step S30 in FIG. 4 can be implemented using the
於圖10的例子中,是對三個工作量子位元q0-q2及輔助量子位元a0進行邏輯運算,並將輔助量子位元a0的最終的量測結果(C)作為第零古典位元。 In the example of Fig. 10, logical operations are performed on the three working qubits q0-q2 and the auxiliary qubit a0, and the final measurement result (C) of the auxiliary qubit a0 is used as the zeroth classical bit. .
於量子邏輯電路7中,工作量子位元q0-q2被變為糾纏態。具體而言,通過Hadamard邏輯閘70來使工作量子位元q0變為疊加態,通過單控制反邏輯閘71使工作量子位元q0-q1糾纏,並通過單控制反邏輯閘72使工作量子位元q0、q2糾纏。
In the
接著,於量子邏輯電路8中,糾纏態的工作量子位元q0-q2糾纏至輔助量子位元a0,並以輔助量子位元的量子態來獲得古典位元。具體而言,以工作量子位元q0、q1為控制位元,以輔助量子位元a0為目標位元執行雙控制反邏輯閘80;以工作量子位元q1為控制位元,以工作量子位元q1為目標位元執行單控制反邏輯閘81;以工作量子位元q1、q2為控制位元,以輔助量子位元a0為目標位元執行雙控制反邏輯閘82。藉此,工作量子位元q1、q2、q3會糾纏輔助量子位元a0,即輔助量子位元a0的量子態可以用來反應工作量子位元q1、q2、q3的量子態。
Next, in the
最後,通過量測邏輯閘83對輔助量子位元a0的量子態進行量測來獲得第零古典位元(即控制線C的輸出)。
Finally, the quantum state of the auxiliary qubit a0 is measured by the
續請一併參閱圖1至圖5,圖5為本發明第四實施例的真亂數產生方法的流程圖。於本實施例中,古典位元的補充(對應圖2的步驟S10-S11,即圖5的步驟S50-S54)與亂數的產生(對應圖2的步驟S12-S14,即圖5的步驟S55-S59)是獨立執行(可先後執行或平行處理),而沒有執行順序關係。 Please refer to FIG. 1 to FIG. 5 together. FIG. 5 is a flowchart of a method for generating a true random number according to a fourth embodiment of the present invention. In this embodiment, the addition of classical bits (corresponding to steps S10-S11 in FIG. 2, namely steps S50-S54 in FIG. 5) and the generation of random numbers (corresponding to steps S12-S14 in FIG. 2, that is, steps in FIG. 5) S55-S59) are independently executed (sequentially executed or processed in parallel), and there is no execution sequence relationship.
此外,於本實施例中,用戶可設定(或由電腦設備1自動設定)補充條件,當補充條件滿足時,電腦設備1會自動補充古典位元緩衝區1031的古典位元。
In addition, in this embodiment, the user can set (or automatically set by the computer device 1 ) the supplementary condition, and when the supplementary condition is satisfied, the
步驟S50:電腦設備1產生古典位元產生請求,並經由網路3發送古典位元產生請求至量子電腦2的雲端應用平台20。
Step S50 : the
步驟S51:量子電腦對多個量子位元執行量測以獲得隨機產生的多個古典位元,並經由網路3回傳這些古典位元至電腦設備1。
Step S51 : the quantum computer performs measurement on a plurality of qubits to obtain a plurality of randomly generated classical bits, and returns these classical bits to the
於一實施例中,古典位元產生請求包括用戶資訊,雲端應用平台20是於用戶資訊通過驗證時,才執行步驟S51的處理。
In one embodiment, the classical bit generation request includes user information, and the
步驟S52:電腦設備1將所收到的古典位元儲存於古典位元緩衝區1031。
Step S52 : the
步驟S53:電腦設備1判斷預設的補充條件是否滿足,補充條件可預存於儲存模組103中。
Step S53 : the
於一實施例中,補充條件可為古典位元緩衝區1031的可用空間大於預設值(即剩餘的古典位元過少)、預設時間間隔經過(如10分鐘)、每次連上網路3時及/或每次收到亂數請求時,不加以限定。
In one embodiment, the supplementary conditions may be that the free space of the
若電腦設備1判斷預設的補充條件滿足,則再次執行步驟S50-S53以再次為古典位元緩衝區1031補充古典位元。
If the
若電腦設備1判斷預設的補充條件不滿足,則執行步驟S54:電腦設備1判斷是否結束補充功能(如用戶關閉補充功能或者與網路3中斷連接等等)。
If the
若電腦設備1判斷不須結束補充功能,則再次執行步驟S53。若電腦設備1判斷結束補充功能,則結束方法。
If the
前述實施例中,一旦網路3的連接中斷且古典位元緩衝區3所儲存的的古典位元用盡,電腦設備1將會無法產生亂數值,而造成用戶不便。
In the aforementioned embodiment, once the connection of the
為解決上述問題,本實施例進一步提出一種混合提供真亂數與模擬亂數的功能,主要是由執行步驟S55-S59來實現。 In order to solve the above problem, this embodiment further proposes a function of providing real random numbers and simulated random numbers in a mixed manner, which is mainly realized by executing steps S55-S59.
步驟S55:電腦設備1判斷是否收到任一亂數請求。如自外部電腦設備4收到亂數請求或用戶經由人機介面102輸入亂數請求。
Step S55: The
若電腦設備1判斷未收到任何亂數請求,則再次執行步驟S55。
If the
若電腦設備1收到亂數請求,則執行步驟S56:電腦設備1判斷是否連接網路3,而可以執行步驟S50-S52的古典位元的補充。
If the
若電腦設備1判斷連接網路3,則執行步驟S57:電腦設備1執行真亂數產生程序(如圖2的步驟S12-S14),以獲得屬於真亂數的亂數值。
If the
若電腦設備1判斷未連接網路3,則執行步驟S58:電腦設備1進一步判斷古典位元緩衝區1031目前所儲存的剩餘的多個古典位元的總長度是否滿足此亂數請求的亂數範圍及/或亂數數量。
If the
舉例來說,若古典位元緩衝區1031僅剩下39位元,但亂數範圍為0至1023(即每個亂數值需10位元),且需要5個亂數值,即總共需要50位元,則電腦設備1可判定古典位元不足產生所有亂數。
For example, if there are only 39 bits left in the
舉例來說,若古典位元緩衝區1031僅剩下4096位元,但亂數範圍為0至1048575(即每個亂數值需20位元),且需要10個亂數值,即總共需要2000位元,則電腦設備1可判定古典位元足夠產生所有亂數。
For example, if the
若電腦設備1判斷古典位元緩衝區1031剩餘的古典位元足夠,則執行步驟S57以產生真亂數。
If the
若電腦設備1判斷古典位元緩衝區1031剩餘的古典位元不足夠,則執行步驟S59:電腦設備1基於該亂數請求的該亂數範圍執行模擬亂數產生程序以產生多個模擬亂數位元作為亂數數列,並對亂數序列執行格式轉換處理來獲得格式符合的亂數值。
If the
藉此,本發明可隨時提供用戶亂數值,並於連接網路3時提供高品質的真亂數。
In this way, the present invention can provide user random numbers at any time, and provide high-quality real random numbers when the
值得一提的是,步驟S58並非本實施例的必要步驟。於一實施例中,本發明的真亂數產生方法亦可被修改為於判斷未連接網路3(步驟S56,否)時,直接執行模擬亂數產生程序(步驟S59)。
It is worth mentioning that step S58 is not a necessary step in this embodiment. In one embodiment, the real random number generation method of the present invention can also be modified to directly execute the simulated random number generation program (step S59 ) when it is determined that the
於一實施例中,電腦設備1可設置量子邏輯電路(如圖9或圖10所述的量子邏輯電路,亦可經由將一份量子電腦程式200移至電腦設備1執行來加以實
現)。於步驟S59中,電腦設備1是經由量子邏輯電路來於本地端模擬執行量子演算法(如前述真亂數產生程序)來獲得亂數。
In one embodiment, the
請一併參閱圖1至圖6,圖6為本發明第五實施例的真亂數產生方法的部分流程圖。於本實施例中,進一步提供一種亂數篩選功能。用戶可於亂數請求中設定亂數條件(如不連號或不重複等等),電腦設備1會依據所設定的亂數條件來篩選所產生的亂數值。
Please refer to FIG. 1 to FIG. 6 together. FIG. 6 is a partial flowchart of a method for generating a true random number according to a fifth embodiment of the present invention. In this embodiment, a random number filtering function is further provided. The user can set a random number condition (such as no consecutive numbers or no repetition, etc.) in the random number request, and the
具體而言,本實施例的真亂數產生方法包括以下步驟。 Specifically, the method for generating a true random number in this embodiment includes the following steps.
步驟S60:電腦設備1接受亂數請求。亂數請求中設定有亂數條件與亂數數量。
Step S60: The
步驟S61:電腦設備1執行亂數產生程序以產生一個亂數值。亂數產生程序可為前述真亂數產生程序、模擬亂數產生程序或兩個混搭,不加以限定。
Step S61: The
步驟S62:電腦設備1判斷所產生的亂數值是否符合亂數條件。
Step S62: The
以亂數條件是不連號為例,電腦設備1判斷所產生的亂數值是否與先前產生的其他亂數值為連號(如先前已產生亂數值3,若本次產生亂數值2,則可判定為連號,若本次產生亂數值1,則可判定為不連號)。
Taking the random number condition as an example of non-consecutive numbers, the
以亂數條件是不重覆為例,電腦設備1判斷所產生的亂數值是否與先前產生的其他亂數值為連號(如先前已產生亂數值13,若本次又產生亂數值13,而可判定為重複;若本次產生亂數值7,而可判定為不重複)。
Taking the random number condition as non-repetition as an example, the
若電腦設備1判斷所產生的亂數值符合亂數條件,則執行步驟S64。
If the
若電腦設備1判斷所產生的亂數值不符合亂數條件,則執行步驟S63:電腦設備1刪除此不符條件的亂數值。
If the
接著執行步驟S64:電腦設備1判斷已產生的和條件的亂數值的數量是否達到亂數數量。
Next, step S64 is executed: the
若尚未達到亂數數量,則再次執行步驟S61;否則,電腦設備1輸出所有亂數並結束本次執行。
If the number of random numbers has not been reached, step S61 is performed again; otherwise, the
續請一併參閱圖1至圖7,圖7為本發明第六實施例的真亂數產生方法的部分流程圖。於本實施例中,進一步提供一種觸發功能。電腦設備1於被觸發後才會接受設定亂數請求,並據以產生亂數值。
Please refer to FIG. 1 to FIG. 7 together. FIG. 7 is a partial flowchart of a method for generating a true random number according to a sixth embodiment of the present invention. In this embodiment, a trigger function is further provided. The
具體而言,本實施例的真亂數產生方法包括以下步驟。 Specifically, the method for generating a true random number in this embodiment includes the following steps.
步驟S70:電腦設備1判斷預設的觸發條件是否滿足,觸發條件可預存於儲存模組103中。
Step S70 : the
於一實施例中,觸發條件可為自外部電腦設備4收到亂數請求。
In one embodiment, the trigger condition may be a random number request received from the
於一實施例中,功能模組104為照相機,用以不斷拍攝環境影像,並傳送至處理模組100(或送至雲端伺服器執行AI人臉辨識),以偵測並辨識人臉。前述觸發條件可為偵測到人臉,或者人臉通過辨識驗證。
In one embodiment, the
於一實施例中,功能模組104為PIR感測器,用以於感測到用戶時觸發訊號。前述觸發條件可為收到PIR感測器的觸發訊號,即偵測到用戶。
In one embodiment, the
若電腦設備1判斷觸發條件不滿足,則再次執行步驟S70以持續判斷。
If the
若電腦設備1判斷觸發條件滿足,則執行步驟S71:電腦設備1經由人機介面102接受用戶的亂數請求操作,並依據亂數請求操作設定亂數請求。
If the
於一實施例中,前述亂數請求操作是輸入亂數範圍、亂數個數及/或亂數條件,但不加以限定。 In an embodiment, the aforementioned random number request operation is to input a random number range, a random number and/or a random number condition, but it is not limited thereto.
步驟S72:電腦設備1基於亂數請求產生對應的一或多個亂數值(亂數值的產生方式如前所述,於此不再贅述)。
Step S72 : the
藉此,用戶可經由觸發電腦設備1來使電腦設備1快速進入可接受操作的狀態,而有效提升輸入請求的效率。
In this way, the user can make the
續請一併參閱圖1至圖8,圖8為本發明第七實施例的真亂數產生方法的部分流程圖。本發明所產生的一或多個亂數值可應用於不同領域,如資訊安全、遊戲與博弈等等。 Please refer to FIG. 1 to FIG. 8 together. FIG. 8 is a partial flowchart of a method for generating a true random number according to a seventh embodiment of the present invention. The one or more random values generated by the present invention can be applied to different fields, such as information security, games and games, and so on.
具體而言,電腦設備1可於產生亂數值後執行步驟S80或S81來應用所產生的亂數值。
Specifically, the
步驟S80:電腦設備1基於所產生的亂數值執行加密處理。
Step S80: The
於一實施例中,電腦設備1可基於亂數值產生加密金鑰,並以此加密金鑰配合對應的加密演算法(如OpenSSL)來對資料或設備進行軟體加密。
In one embodiment, the
步驟S81:電腦設備1基於所產生的亂數值計算遊戲結果。
Step S81: The
於一實施例中,遊戲為骰子遊戲,電腦設備1是產生1-6之間的亂數值作為電子骰的點數,但不以此限定,所有使用亂數的遊戲皆可運用本發明所產生的真亂數來提升隨機性。
In one embodiment, the game is a dice game, and the
綜上所述,本發明所產生的亂數值是具有極佳的可用性。並且,由於本發明所產生的是真亂數,無法被預測與重複,更進一步提升了加密的安全性與遊戲的公平性。 In conclusion, the random value generated by the present invention has excellent usability. Moreover, since the generated random numbers of the present invention cannot be predicted and repeated, the security of encryption and the fairness of the game are further improved.
以上所述僅為本發明之較佳具體實例,非因此即侷限本發明之專利範圍,故舉凡運用本發明內容所為之等效變化,均同理皆包含於本發明之範圍內,合予陳明。 The above description is only a preferred specific example of the present invention, and therefore does not limit the scope of the patent of the present invention. Therefore, all equivalent changes made by using the content of the present invention are all included in the scope of the present invention. bright.
S10-S14:第一亂數產生步驟 S10-S14: The first random number generation step
Claims (9)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW109105753A TWI757694B (en) | 2020-02-21 | 2020-02-21 | Method of generating true random numbers based on quantum computing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW109105753A TWI757694B (en) | 2020-02-21 | 2020-02-21 | Method of generating true random numbers based on quantum computing |
Publications (2)
Publication Number | Publication Date |
---|---|
TW202133056A TW202133056A (en) | 2021-09-01 |
TWI757694B true TWI757694B (en) | 2022-03-11 |
Family
ID=78777436
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW109105753A TWI757694B (en) | 2020-02-21 | 2020-02-21 | Method of generating true random numbers based on quantum computing |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI757694B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI826040B (en) * | 2022-10-12 | 2023-12-11 | 財團法人工業技術研究院 | Quantum circuit design method and apparatus |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1190278B1 (en) * | 2000-03-09 | 2006-10-18 | STMicroelectronics S.r.l. | Method and hardware architecture for controlling a process or for processing data based on quantum soft computing |
CN102955855A (en) * | 2012-10-30 | 2013-03-06 | 河南理工大学 | Palm print database search method based on quantum algorithms |
CN109934351A (en) * | 2019-03-06 | 2019-06-25 | 南京航空航天大学 | A kind of quantum learning aid algorithm and the modified fuzzy sliding mode controlling method based on quantum learning aid algorithm |
CN110134369A (en) * | 2019-04-15 | 2019-08-16 | 深圳市纽创信安科技开发有限公司 | Randomizer, random number generation method and chip |
CN111461335A (en) * | 2020-04-03 | 2020-07-28 | 合肥本源量子计算科技有限责任公司 | Noise-containing single-quantum logic gate implementation method and device based on MPI (Multi-processor interface) multi-process |
-
2020
- 2020-02-21 TW TW109105753A patent/TWI757694B/en active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1190278B1 (en) * | 2000-03-09 | 2006-10-18 | STMicroelectronics S.r.l. | Method and hardware architecture for controlling a process or for processing data based on quantum soft computing |
US7383235B1 (en) * | 2000-03-09 | 2008-06-03 | Stmicroelectronic S.R.L. | Method and hardware architecture for controlling a process or for processing data based on quantum soft computing |
CN102955855A (en) * | 2012-10-30 | 2013-03-06 | 河南理工大学 | Palm print database search method based on quantum algorithms |
CN109934351A (en) * | 2019-03-06 | 2019-06-25 | 南京航空航天大学 | A kind of quantum learning aid algorithm and the modified fuzzy sliding mode controlling method based on quantum learning aid algorithm |
CN110134369A (en) * | 2019-04-15 | 2019-08-16 | 深圳市纽创信安科技开发有限公司 | Randomizer, random number generation method and chip |
CN111461335A (en) * | 2020-04-03 | 2020-07-28 | 合肥本源量子计算科技有限责任公司 | Noise-containing single-quantum logic gate implementation method and device based on MPI (Multi-processor interface) multi-process |
Also Published As
Publication number | Publication date |
---|---|
TW202133056A (en) | 2021-09-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10630492B2 (en) | Device and method for testing a physically unclonable function | |
CN111967609B (en) | Model parameter verification method, device and readable storage medium | |
JP6277734B2 (en) | Information processing program, information processing apparatus, and information processing method | |
CN109614790B (en) | Lightweight authentication equipment and authentication method based on feedback loop PUF | |
TW202107305A (en) | Model parameter determination method and device and electronic equipment | |
EP3542261B1 (en) | Method for performing a trustworthiness test on a random number generator | |
WO2021135638A1 (en) | Method and apparatus for detecting whether image is tampered with, and electronic device | |
WO2022033219A1 (en) | Face liveness detection method, system and apparatus, computer device, and storage medium | |
TWI757694B (en) | Method of generating true random numbers based on quantum computing | |
US20200110906A1 (en) | Encryption circuit for performing virtual encryption operations | |
TW201710953A (en) | Electronic device and system and method of controlling access to the same | |
TWI769603B (en) | Image processing method and computer readable medium thereof | |
CN107133517B (en) | Data recovery method based on data encryption and calculation in memory | |
Avvaru et al. | Predicting hard and soft-responses and identifying stable challenges of MUX PUFs using ANNs | |
CN111126214A (en) | Living body detection method and apparatus, computer device, and computer-readable storage medium | |
WO2022087829A1 (en) | Data processing circuit, data processing method, and electronic device | |
Hamburg | Understanding intel’s ivy bridge random number generator | |
CN112882951A (en) | Vehicle small program testing method, device, equipment, storage medium and program product | |
CN111209050A (en) | Method and device for switching working mode of electronic equipment | |
Pan et al. | Side-channel analysis-based model extraction on intelligent CPS: An information theory perspective | |
KR20200017038A (en) | Apparatus and method for message authentication | |
US20230177154A1 (en) | Sparse Encodings for Control Signals | |
CN112016632B (en) | Model joint training method, device, equipment and storage medium | |
US11621852B1 (en) | System and method for providing a multiple-operation transaction to a blockchain | |
TWI692731B (en) | Object position determination circuit |