That I'm starting to turn into a programmer.
Before, I was a superscriptkiddy, always just downloading other people's tools.
Today, I needed a tool to find the frequency of letters and numbers in a huge string of text, and was like "Well shit, how am I gonna find a tool that can do this?" then I was like "Wait, I'm a retard. I can just program it." and made my own!
I'll release it on GitHub in a few days after I polish it up a bit, but here's it's main use:
1.) Get a huge list of pin numbers (For example, Gaia cash card pin numbers or something. Doesn't matter if they're used or not.
2.) Convert them into one line of raw text. Eg:
Pins:
1JK4214J54
4U3UJI4O3F
R324KJL234
To this:
1JK4214J544U3UJI4O3FR324KJL234
(It's all of the pins combined.)
3.) Input that into the program I made (It will then store each character into a slot in a huge array, so max of like 100 separate pins is all you should do per run)
4.) It will output a text file with the frequency of each letter of the alphabet and each number listed
The output looks like this
A: *****
B: *
C: ************
D: ******
etc etc, where there's a star for each time the character appears in the huge string of pins. (I'll have to simplify it somehow so that if you enter a ton of pins it doesn't make a 200MB text file of stars.)
Why did I make this? I don't know, I didn't know if it would help me crack the algorithm for the random generation of pin numbers on these cards I have or not. Never tried it before, so I made this program, wondering if finding commonly used characters would help.
Anyway, will release in a few days!
Results 1 to 7 of 7
Thread: I finally realized
- 24 Mar. 2013 07:14pm #1
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 8.48
I finally realized
- 24 Mar. 2013 08:31pm #2
Cool!
For the output, you could just do something like this:
Code:Total characters = 30 A = 5% of all characters B = 7% of all characters ... Z = 0% of all characters ...
- 24 Mar. 2013 08:34pm #3
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 0.56
- 27 Mar. 2013 06:17pm #4
Great job. Frequency analysis is a cool process. I know it's used for improving bruteforce attacks and such.
I usually use the method of word frequency analysis instead of character frequency analysis at school to check which words I'm using way too frequently in a report and thus improve my writing style.I don't get tired.
- 27 Mar. 2013 07:20pm #5
- Join Date
- Apr. 2010
- Location
- When freedom is outlawed only outlaws will be free
- Posts
- 5,113
- Reputation
- 195
- LCash
- 1.06
- 27 Mar. 2013 07:57pm #6
Yeah, I did build my own, but I don't know where it is at the moment.
I still have a letter frequency analyzer I built in Java lying around somewhere though.
I'll probably build a new one for this machine that's a bit faster soon.
Pretty sure Microsoft Word doesn't have one built in, but I could be wrong.I don't get tired.
- 27 Mar. 2013 10:43pm #7
Your method though sounds incredibly inefficient :p There's no need to store each individual character in to a separate array element (and hence allocation of memory :p). Moreover, you shouldn't have to bother with the asterisks until you decide to output the information. See something like this:
PHP Code:<?php
function alphaNumCount($str) {
$occurences = array();
// Find occurences of each number in the string
for ($ascii = ord(0); $ascii <= ord(9); $ascii++) {
$occurences[chr($ascii)] = substr_count($str, chr($ascii));
}
// Convert to uppercase and find occurences of each letter
$str = strtoupper($str);
for ($ascii = ord('A'); $ascii <= ord('Z'); $ascii++) {
$occurences[chr($ascii)] = substr_count($str, chr($ascii));
}
return $occurences;
}
// Output the frequency distribution table
$pins = '1JK4214J544U3UJI4O3FR324KJL234';
foreach (alphaNumCount($pins) as $char => $freq) {
printf("%s: %s\n", $char, str_repeat('*', $freq));
}
Code:0: 1: ** 2: *** 3: **** 4: ******* 5: * 6: 7: 8: 9: A: B: C: D: E: F: * G: H: I: * J: **** K: ** L: * M: N: O: * P: Q: R: * S: T: U: ** V: W: X: Y: Z: