glaufan Posted September 25, 2008 Share Posted September 25, 2008 hiThis post is in literate Haskell which means the entire post can be posted into a .lhs file and compiled by GHC.Haskell is a lazy pure functional programming language named after the logician Haskell Curry.http://en.wikipedia.org/wiki/Haskell_(programming_language)http://haskell.orgThe following code generates a random cd key for an old game, Battlefield 1942. I derived the keygen method with OllyDBG on a random keygen I found on astalavista. Thanks NaG-Scrim/Fighting For Fun - it had good music ;D but your generated code is weird, either msvc6 is not so smart at optimization or your src code is strange, never mind I still made sense of the larger picture.> import Char> import Random> import Text.Printf> import System.IO> genkey :: String -> String> genkey inp = inp ++ (fmt first_number) ++ (fmt last_number)> where last_number = compute last_sequences magic_1> last_sequences = (map (\x -> read x :: Int) (sp (inp ++ "00000") 4 5 []))> magic_1 = 0x43> first_number = compute first_sequences magic_2> first_sequences = (map (\x -> read x :: Int) (sp ("00000" ++ inp ++ "00000") 4 7 []))> magic_2 = 0x25> compute :: [Int] -> Int -> Int> compute = mod . sum> fmt v = printf "%02u" (v::Int) :: Stringsplit a string into i parts n times> sp :: String -> Int -> Int -> [String] -> [String]> sp xs 0 n acc = acc> sp xs i n acc = sp (drop n xs) (i-1) n (acc ++ [(take n xs)])> main = do num <- randomRIO ((10^17 :: Int),(10^18-1 :: Int))> putStrLn $ show $ genkey $ show num Link to comment
r00t_H@ck3r Posted September 26, 2008 Share Posted September 26, 2008 Never Hear Before But Nice Job,What Program You Use To Code ? Link to comment
mudlord Posted September 26, 2008 Share Posted September 26, 2008 http://haskell.org/ghc/download_ghc_683.html#window Link to comment
glaufan Posted September 26, 2008 Author Share Posted September 26, 2008 [quote name=' Link to comment
r00t_H@ck3r Posted October 28, 2008 Share Posted October 28, 2008 Does Haskell Support ? Socket,SQL Function 0.o Bytes ? Etc Link to comment
r00t_H@ck3r Posted November 1, 2008 Share Posted November 1, 2008 Not Bad,How Long You Took To Learn It ? Link to comment
r00t_H@ck3r Posted November 2, 2008 Share Posted November 2, 2008 Well I Am More Into C# = ) Link to comment
zer0patches Posted November 20, 2008 Share Posted November 20, 2008 (edited) I started in ...BASIC > Pascal > Motorola Assembly > Z80 Assembly > x80/86 Assembly > C (Dos) > Visual Basic > Visual C++ > .Net > Currently learning C# and Revamping my Assembly knowledge under WindowsI kind of got out of Assembly when I got into structured languages. I did used to code some of my sub routines in assemby when I was taking C in college. My professor didn't know what to think but my programs ran faster than anyone else, lol.I really got away from programming for a while and worked on mainly hardware hacking/mod'ing.Never heard of Haskell but it seems interesting. I would like to do some ASIC programming. -D Edited November 20, 2008 by ZeR0Patches Link to comment
glaufan Posted January 13, 2009 Author Share Posted January 13, 2009 I know some people were interested in hearing about Haskell, here is a short podcast from the Parallel Programming section at Intel (15 minutes / 3.4MB) that might spur your interest some more.http://www.blogtalkradio.com/MulticoreSoft...Don-Stewart.mp3 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now