# Cryptography key strength/"break-ability"

Page 1 of 1

## 1 Replies - 1842 Views - Last Post: 07 July 2012 - 01:13 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=285013&amp;s=5eb59dc723db7754cbbf96b02f34bd58&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 BloodyInari

Reputation: 6
• Posts: 106
• Joined: 16-November 09

# Cryptography key strength/"break-ability"

Posted 07 July 2012 - 12:56 AM

So, as I was working on a method for extended FOIL operations via recursion, I noticed a numerical pattern that tended to arise which as a string grew in exponential length as the number of terms involved increased monotonically. This string, rather pattern, caught my interest after I finished developing said method and I began to play with it as an idea for a cryptographic-key generator. To ensure that the key was not explicitly understood, I converted each specific element of the sequence over to binary, reconfigured it back into a string and converted back to base_10 as a numerical value to be implemented. As a mathematician and a beginner programmer in this field of interest (crypto), I would like to hear you input in the utility, strength or lack thereof, or any interest in the little project I had been developing recently as well as input, provided it would be useful (or otherwise), on utilizing my method for encryption.

Some details, as said before, is that the length of the string grows exponential, which is just nearly as true as it does as a base_10 value; however, in base_10 format, I have been unable to predict the "exponential" rate of growth, so it appears to be a psuedo-random number than can be generated by an explicit function. And because it grows so fast, factorization of the key into its trivial parts quickly becomes more difficult and time consuming.

Let me know what you guys think. Code below is the functional program (currently set up for user input, but that can be subject to change as I might alter the function at a later time) as is and displays in the console/shell upon being imported.

```#base 10 to base 2 converter
def DenaryToBinary(n):
binStr = " "
if n < 0:
raise ValueError, "must be a positive integer"
if n == 0:
return eval("0")
while n > 0:
binStr = str(n%2) + binStr
n = n >> 1
return eval(binStr)

def main():
#sets up while loop parameters
n = input("How many iterations?: ")
i = 0
sum = 0.0

#initial variables, iter = 0
a = [0]
arraySum = []
initBinArray = []
initializer = [0]
outputArray = [0]
storeArray = initializer
storeArray[0] = initializer[0] + 1
String = ""

print "0th iteration\t", a, "\n"

#while loop to nth iterations
while i in range(n):

#prior array incremented by one to new array
for p in range(2**(i)):
outputArray[p] += 1
#prior array and adds to current array
for q in range(2**(i)):
outputArray.append(storeArray[q]-1)
#sums elements of array
for r in range(len(outputArray)):
sum += outputArray[r]
arraySum.append(sum)
#coverts elements of outputArray to binary; then coverts entire array contents to string
for z in range(len(outputArray)):
initBinArray.append(DenaryToBinary(outputArray[z]))
String += str(initBinArray[z])

#output data
print str(i+1)+"th iteration", "\t", outputArray
print str(i+1)+"th iteration sum: ", sum
print "Conversion value:", int(String,2), "\n"

#reconfiguring critical variables
i += 1
initBinArray = []
storeArray = outputArray
String = ""
sum = 0.0

#ratio of sequential elements
#for j in range(len(d)-1):
#    ratio = d[j+1]/d[j]
#    print j, "\t", ratio
#limit(ratio, as j approaches infinity) = 2
main()

```

Is This A Good Question/Topic? 0

## Replies To: Cryptography key strength/"break-ability"

### #2 BloodyInari

Reputation: 6
• Posts: 106
• Joined: 16-November 09

## Re: Cryptography key strength/"break-ability"

Posted 07 July 2012 - 01:13 AM

which if I run my input where n=10 (and ignoring two three lines of print statements), I output as so:
```2

22

3766

167206582

12858878609648475830

9355579436852690246063798285552424328847030

8192630880754067407462525912468585731767388816864977441988864807267251041191986799910130769590

344376630940667968597430352703232036344651113333330943744544049074657040015443662974307829894584801533735660662523467053312944396553210124220584392037309668597516753425846922941716448322637985796808374

1055290433553306856146613578315728732836190006401686327642996974023546773240627454676820927053825694724528901708118853544197044651182584897801377948884247653562688047482606754839793744797510317580600698549689513011064246609499338129821422340374957512121672927835281457616702030217907001806604988413302614766819684586577372422311572790520815132620742379221556529963853901545268413955159379783939264782109392481301248330915510

1413816633685686735287164697981690151687861682216101403072977218972836740405229963627003432383575313948022529001776415624477251276758258176770770145241142585063467458756098822794895501163447481537573579591505312914847900488672339899419051062195056841273829480387866294583760397603017338646717924292876745163302067425430251859504265301492938853843796242214554007397758776654122014182470310519438674672674876272274314451756520538265727919968353549766954025802447469659456990477366797601688927304676898737233706199860015279440376432925174641851295921101191191028572786194402489528591893910277618352761899047416025880184796720408417170169940896207331032001337739167653570784701899160511309110302292345129300167494590266935805567905933591233841797073252150251340079087844827534887987079221276385388135873476730695484765609593458283917328775108715538554660739886482000328053898320499669687990

```

This post has been edited by BloodyInari: 07 July 2012 - 01:15 AM