Place to post scripts and what not

Got an idea on how things should be done? A problem with something on the site? Voice your opinion!

Place to post scripts and what not

Post by 0phidian on Sat Jul 27, 2013 11:25 am
([msg=76642]see Place to post scripts and what not[/msg])

I thought it might be pretty cool if a forum was created specifically for people to post their own scripts/programs for others to use and learn from. I know there are already some posts like this but they are scattered around the forums and burried under random posts. So I thought it would be nice if they were all in one, easy to find place. I would like to see some other members work as well as submit some of my own.
User avatar
0phidian
Poster
Poster
 
Posts: 270
Joined: Sat Jun 16, 2012 7:04 pm
Blog: View Blog (0)


Re: Place to post scripts and what not

Post by TooNerdAster on Mon Jul 29, 2013 3:08 am
([msg=76666]see Re: Place to post scripts and what not[/msg])

I really like Ophidian's idea: now I'm only a newbie and I noticed that reading code is one of the practices that helps me learning most; it would be awesome to have a place to post your codes, open to newbies and to experienced people that could post their own codes to make it better or to share it with others. Love it.

Aster
"If you have an apple and I have an apple and we exchange these apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas."
User avatar
TooNerdAster
New User
New User
 
Posts: 7
Joined: Mon Jul 22, 2013 3:53 am
Blog: View Blog (0)


Re: Place to post scripts and what not

Post by -Ninjex- on Mon Jul 29, 2013 4:13 am
([msg=76667]see Re: Place to post scripts and what not[/msg])

If it wasn't such a bad idea for me to necro all of my old posts of some scripts I have made, I would post it here.
However that a bit much. So with that said, I like the idea as well. I just feel like it will get lost in the rubble of older posts as well, unless this thing can pick up some attention and get stickied or something.

-- Mon Jul 29, 2013 9:45 pm --

0phidian wrote:I thought it might be pretty cool if a forum was created


Forum, thread, topic, whatevs lol I got your point lol
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
^(-.^)>
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1468
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Place to post scripts and what not

Post by v4ry5 on Mon Aug 05, 2013 12:38 pm
([msg=76756]see Re: Place to post scripts and what not[/msg])

+1.

Also, maybe in conjuction with this idea or as it's own separate thing, I think it might be cool if certain parts of the forum were only accessible to members who had met certain participation requirements. I don't have any really fixed ideas about what the requirements would be like. Obv the simplest thing would be a subforum that is only viewable to members. But you could take it further and require a certain amount of mission points, forum posts or IRC time, etc.

Although I realize it's a tangent, I think it fits in a way with this thread since the benefit is that you're sharing information with people who are ostensibly fellow participants rather than random leeches who stumble upon your code without contributing anything other than a page hit.
v4ry5
New User
New User
 
Posts: 11
Joined: Sat Jul 20, 2013 7:00 am
Blog: View Blog (0)


Re: Place to post scripts and what not

Post by 0phidian on Sun Aug 25, 2013 4:46 pm
([msg=77030]see Re: Place to post scripts and what not[/msg])

Bump
User avatar
0phidian
Poster
Poster
 
Posts: 270
Joined: Sat Jun 16, 2012 7:04 pm
Blog: View Blog (0)


Re: Place to post scripts and what not

Post by -Ninjex- on Sun Aug 25, 2013 6:38 pm
([msg=77031]see Re: Place to post scripts and what not[/msg])

Since this has nothing so far, I figured I could post a simple encoder that shows the basics of how it works using keys
The code below is in Ruby, and uses a very simple algorithm to encode the data. This is for demonstration.
If this was to be pushed somewhere like a database, we could push it with the users IP as well, and use it as a salt.
If we didn't use a static IP like below, the decryption function should be changed to use a specified IP as a salt.

Code: Select all
#!/usr/bin/ruby
require 'digest/md5' # Included for MD5 hashing functionality
$prompt = "> " # Making a global variable for a text input prompt

def convert_ip(ip)    # Here we take an IP, remove the .'s, and get a value
  ip = ip.split('.')  # Split the IP via .'s into an array i.e 127.0.0.1 = array { 127, 0, 0, 1 }
  ip_value = ''
  ip.each do |num|    # For every item inside of the ip array
    ip_value += num   # Concatenate that item to the ip_value var
  end
  return ip_value     # Return the ip with all .'s removed
end

ip = "127.0.0.1"      # Here we would use a function to grab the IP
$ip = convert_ip(ip)  # Call our function to remove .'s and convert to integer so we can use it for hashing
def encrypt_text      # Using MD5 with a key and IP value to get a hash value, conver that into an integer, for an encoder
  puts "Enter String to Encrypt"
  print $prompt
  string = gets.chomp

  puts "Enter a key:"
  print $prompt
  key = gets.chomp

  key = Digest::MD5.hexdigest($ip+key) # Get MD5 hash of the user's IP and the chosen key concatenated
  key_value = 0
  key.each_byte do |char|   # For every character in the md5 value
    key_value += char       # Add that characters ascii value to key_value
  end
 
  encryption = ''
  string.each_byte do |ascii| # For every character in the string to encrypt
    ascii += key_value        # Add our key_value to that character
    ascii = ascii.to_s        # Convert the integer to a string
    encryption += ascii+"+"   # Concatenate it to our final encryption
  end
  puts "Encrypted String:"
  puts encryption.chop! # Print the data, with the last character removed (appeneded ! removed)
end

def decrypt_text
  puts "Enter a string to decrypt:"
  print $prompt
  string = gets.chomp

  puts "Enter the key value for the string:"
  print $prompt
  key = gets.chomp

  key = Digest::MD5.hexdigest($ip+key) # Get MD5 hash of the user's IP and the chosen key for decryption concatenated
  key_value = 0
  key.each_byte do |char|  # For every character in the md5 value
    key_value += char      # Add that characters ascii value to key_value
  end

  original_text = ''
  string = string.split('+')  # Split string into an array, seperated by +'s (same as IP)
  string.each do |item|       # For every value in our string array, convert it to an integer
    item = item.to_i          # Convert the item into an integer
    item -= key_value         # Subtract the key_value from that integers value
    char = item.chr           # Convert the integer into a character stored in var char
    original_text += char     # Concatenate that character to the original_text var
  end

  puts "The original text is:"
  puts original_text
end

while true do # Make a little menu with this endless loop
  puts "Would you like to [q]uit, [e]ncypt, or [d]ecrypt text?"
  print $prompt
  choice = gets.chomp
  if choice == "e"
    encrypt_text
  elsif choice == "d"
    decrypt_text
  elsif choice == "q"
    abort("Exiting program")
  else
    puts "Invalid choice. Use [e]ncrypt or [d]ecrypt: e / d"
  end
end


Image
If you're not willing to learn, no one can help you. If you're determined to learn, no one can stop you.⠠⠵
The absence of evidence is not evidence of absence.
I can explain it for you, but I can't understand it for you.
^(-.^)>
User avatar
-Ninjex-
Addict
Addict
 
Posts: 1468
Joined: Sun Sep 02, 2012 8:02 pm
Blog: View Blog (0)


Re: Place to post scripts and what not

Post by DarkDexter on Wed Aug 28, 2013 6:01 pm
([msg=77096]see Re: Place to post scripts and what not[/msg])

Nice little Ruby project, Ninjex. Also, gotta back the idea of a scripts section/thread, totally makes sense to me!
"Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning."
-Albert Einstein
User avatar
DarkDexter
New User
New User
 
Posts: 11
Joined: Sun Jul 14, 2013 11:53 am
Blog: View Blog (0)



Return to Comments & Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests