Use GitHub as a private code management repository

Source: Internet
Author: User
Tags ord

because of the job needs, want to use GitHub as the company's code management warehouse, but can not expose the code, so it is very simple, is encrypted and then git upload. The encryption algorithm naturally chooses the high efficiency, but also is safe at the same time. But historically it seems like both of these are against, and I'm saying I'm going to design my own encryption algorithm. Will you squirt me? But I just designed it myself.

The idea is simple, that is, a random sequence with the same number of bits as the plaintext and the plaintext XOR! Pseudo-random number generator is also my own DIY! If you suspect the security of my encryption algorithm because of these two points, just wait a moment. This pseudo-random number generator is the simplest single-peak mapping using the chaotic equation (logstic map): xn+1=a*xn* (1-XN), which can be seen in the English version of Wikipedia:https://en.wikipedia.org/ Wiki/logistic_map said: The relative simplicity of the Logistic map makes it a widely used point of entry into a Consi Deration of the concept of chaos. A rough description of chaos is that chaotic systems exhibit a great sensitivity to initial conditions-a property of the L Ogistic map for most of the values of R between about 3.57 and 4 (as noted above).

I used NIST's random monitoring tool to detect the randomness of the sequence generated by a logistic map after selecting the appropriate a value (to intercept the number of decimal places after the fifth digit of each resulting number as the random numbers), and found that it is even better than most pseudo-random algorithms, It's even better than some pseudo-random algorithms used in the field of security. And the biggest advantage is that people are fast.

So, this is a highly customizable pseudo-random number generator, a value as long as the selection between 3.57~4. So the selected a is different, the algorithm used for encryption has changed (the algorithm has not changed, but the equivalent of a change). This encryption method is similar to a one-time, so it is impossible to find the solution from the analysis of ciphertext, because the ciphertext is random. So the solution is a brute force method, but everyone uses the encryption algorithm can be different, after all, the change of a value is too simple. The other is the initial value of the Xn, which is the encryption key. Any value between (0,1) when the initial value is required, but does not include 0 and 1. The deferred value is also always within that interval.

Using brute force method, complexity depends on the effective number of xn. The number of double types has a valid number of 16~17 bits, so the complexity of the key is about 1016, approximately 253, which means that the cryptographic algorithm key length is 53 bits. Well, first of all, I think that's enough because no one knows my encryption algorithm, even though I make the algorithm public because I can change the value of a. Second, in the encryption, is the 5th to 8th digit of the borrowing Xn and Unicode xor, I can change to the 12th to 16th bit completely. Even so, we can arbitrarily increase the number of significant digits of the recursive operation, although this will lead to the loss of efficiency. You can use 50-bit or even higher-precision floating-point numbers, 50-bit complexity can reach 1050, equivalent to the 2165~2170 bit key length. In short, this is an unrestricted algorithm. If the quantum computer comes, brute force 100-bit key length of the algorithm needs 1 seconds, then you can use 10,000-bit Ah, the search domain increased by 1010000-10100, anyway time or exponential growth ...

  algorithm originally encrypted output is garbled, and later instead output Unicode digital code, This network compatibility is better (not because of garbled empty lattice missing one and all cannot decrypt). No, paste the python code:

Import os#-*-coding:utf-8-*-import tkinter as Tkimport tkinter.messageboximport tkinter.ttk as Ttkimport osclass Window : Def __init__ (self,root): SELF.LABEL=TTK. Label (Root, text= ' Input PassWord: ') self.entry=ttk. Entry (root,show= ' * ') self.passw= "if os.path.exists (' Important_file '): With open (' Important_file            ') as F:self.passw=f.readline () else:self.label.pack (side= ' left ', anchor= ' NW ', pady=10) Self.entry.pack (side= ' top ', after=self.label,anchor= ' NW ', pady=10) pass Self.butt ON=TTK. Button (Root, text= ' decryption ', command=self. Decipher) Self.button.pack (side= ' top ', anchor= ' NW ') self.button=ttk. Button (root,text= ' encrypt ', command=self. Encrypt) self.button.pack (side= ' top ', anchor= ' NW ') self.texti=tk.                Text () #self. Texti.insert (1.0, ' Input something here. ') Self.texto=tk. Text () self.texti.pack (side= ' top ', anchor= ' NW ', pady=20) Self.texto.pack (side= ' top ', anchor= ' NW ', pady=20) self.inputext= ' d                EF Decipher (self): if isn't self.passw:self.passw=self.entry.get () if not SELF.PASSW: Tk.messagebox.showinfo (' Error ', ' Why not ' enter the password? '); Return Self.inputext=self.texti.get (1.0,TK. END) If self.inputext== ': Tk.messagebox.showinfo (' Error ', ' What's your inputext? '); return if not Self.inputext[0].isdigit (): Tk.messagebox.showinfo (' Error ', ' is sure that your input starts with Digi Ts! ');             Return Self.__crack () def Encrypt (self): if not self.passw:self.passw=self.entry.get () If not self.passw:tk.messagebox.showinfo (' Error ', ' Why not ' enter the password? '); Return Self.inputext=self.texti.get (1.0,TK. END) If self.inputext== ': Tk.messagebox.showinfo (' Error ', ' What's your inputext? '); return if Self.inpuText[0].isdigit (): If not Tk.messagebox.askyesno (' Note ', ' is you sure is encrypting digits? '): Return                  Self.__encrypt () def __crack (self): "indicates that the input text should is number only" Self.texto.delete (1.0,TK.        END) listp=list (SELF.PASSW) P=[ord (x) for x in LISTP] pw=1 for x in P:PW=X*PW Pws= ' 0. ' +STR (PW) pw=float (PWS) Listin=self.inputext.split (") for x in listin:pw=pw* (1-PW) *3.9 3699989893668722729139042 pws=str (PW) pivot= Int (pws[-6:-3]) if x== ': Sel F.texto.insert (tk. INSERT, ') elif x[0]== ' \ n ': Self.texto.insert (tk. INSERT, ' \ n ') Else:self.texto.insert (tk. INSERT,CHR (int (x) ^pivot)) If not os.path.exists (' Important_file '): SELF.__WRITEPW () pass def __encrypt (SE LF): "' Turn string into number string every word takes one Lines ' Self.texto.delete (1.0,TK. END) listin=list (self.inputext) listp=list (SELF.PASSW) P=[ord (x) for x in LISTP] pw=1 F or x in P:PW=X*PW pws= ' 0. ' +STR (PW) pw=float (PWS) for X in listin:pw=pw* (1-PW) *3.936999898936687 22729139042 pws=str (PW) pivot= Int (pws[-6:-3]) Self.texto.insert (TK.            Insert,str (ord (x) ^pivot) + ') Pass def __WRITEPW (self): with open (' Important_file ', ' W ') as F: F.write (SELF.PASSW) os.system (' attrib +s +r +h +a important_file ') root=tk. Tk () root.title (' Our CIPHER Talk ') Window=window (root) root.mainloop () code is Python3, requires tkinter,windows to run, and other systems are unknown. This is just a combination of encryption and decryption program, blogger based on the algorithm written to transform GitHub into a private warehouse code on my github address: https://github.com/AdaJass/privatesolution

GitHub as a private code management repository

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.