Mandatory

- friends
54 link karma
1,079 comment karma
send messageredditor for
what's this?

TROPHY CASE


  • Two-Year Club

    Verified Email

Any crypto nerds want a job? by iorgfeflkdin montreal

[–]Mandatory 1 point2 points ago

sorry, this has been archived and can no longer be voted on

I was a bit bored, so I'll go for it.

The basic idea behind crytography is that you want a way to pass around information to only the people who should see it, and the best way of making sure of this is to give those people some sort of secret that will let them, and only them, to easily figure out the information you're passing. You can think of it as basically just a key and a lock, where the secret you're passing is the 'key', and the message you're trying to pass is the 'lock'. Without the key, opening the lock would be nearly impossible, but it would be a simple matter for the person who does have it.

What modern-day algorithms do is basically similar to this, but with a slight twist. The problem with the idea above is that you still need to give the secret to everyone involved, which could be insecure. Over the Internet, you never know who you might be actually sending your secret to. Because of that, it could be easy for some malicious person to pretend to be someone you trust, get the secret, and be able to read any future messages that you send from now on. So how do we get past this?

Using the key and lock analogy again, instead of giving everyone the 'key' (secret) beforehand, each person has their own key that they never tell to anyone else. So now, instead of passing a key around, each person publicly passes around a lock that only opens to their own personal key. If we have two people, Alice and Bob, if Alice wants to send a secured message to Bob, she would take one of Bob's locks and lock her message inside a chest closed by it. Now, since no one else has a key to that lock except for Bob, no one else should be able to open it. It doesn't matter whether or not some malicious hacker gets a hold of one of Bob's locks, since the only thing that they would ever be able to do with it would be to lock a message for Bob, not to open anything already locked.

So what crytography algorithms nowadays do is generate these key and lock pairs for people to use, but there's still one problem we haven't addressed yet. How can we make sure that someone wouldn't be able to reverse-engineer a key if they have the lock? One of the most famous algorithms, the RSA algorithm, prevents this from happening by generating keys and locks using something called a trapdoor function.

For computers, keys, locks, and even messages are basically numbers. So what a trapdoor function basically does is that it converts a few numbers (the keys) into different numbers (the locks) very easily, but makes it very difficult to convert those same locks back into their keys. Think of it like, well, a trapdoor, where it might be very easy to fall into a trap, but very hard to get back out. The RSA algorithm does exactly this, through multiplying together different prime numbers.

If I gave you two prime numbers, like 17 and 53, then you could very easily tell me what their product (901) would be. But if I gave you 901, it would be much harder for you to figure out what those prime numbers were at the very beginning. The RSA algorithm does exactly this, but just a little bit more complex. So how it works:

  1. Choose any two prime numbers, 'p' and 'q'.
  2. Multiply them together to get their product 'n', the first part of our lock, or whta we call the public key.
  3. Find out how many numbers share no factors with that product, except for 1 (this number is called the totient 't')
  4. Choose a positive number 'e' that is less than the totient and also shares no factors except for 1 with the totient. This will be the second part of our public key.
  5. Find some value 'd', such that d * e % t = 1. The '%' sign here means modulus, and it's basically the remainder when d*e is divided by t. This your own key, or what we call the private key.

So let's try an actual example. We'll choose 17 and 53 again.

  1. Our prime numbers are 17 and 53.
  2. Multiplying them together gives us 901.
  3. The third step seems hard, but there's a shortcut since we're dealing with the product of two primes. You can just use the equation 't = (p - 1)(q - 1)' So in our case, our totient = (17 - 1) * (53 - 1) = 832
  4. And for the last step, we can just choose a number we already know is prime since we'll know they won't share any factors unless 832 is divisible by it. We'll pick 3.
  5. We can rewrite the formula above as d = (1 + nt) / e for integer solutions of d and n is any positive integer, since we're just basically trying to find out when we will have a remainder of 1. Trying out different values of n: n = 1 -> (1 + 832) / 11 -> Not an integer n = 2 -> (1 + 2*832) / 11 -> 555, so our d = 555

Now we have our public key (832) and our private key (555), so time for the fun part. We give the public key (n = 901, e = 3) to our friends so that they can use it to encode things. How do they do that?

They first have to turn the message they want to encode into a number. To keep it simple, we'll just use a simple alphabet cipher for now (so A = 1, B = 2, ... , Z = 26)

If they want to encode "HI", then we'll turn it into "89", using the simple alphabet cipher. Now to encode each with our public key.

The equation to use is encoded_message = plain_message^e % n. From before, our 'e' and 'n' were 11 and 901, so to encode '89', we can just do:

893 % 901 = 387, which is our final encrypted string.

To decrypt it, we can now use our private key, which will work for only this public key.

We use a similar equation decoded_message = encoded_message^d % n. From before, our 'd' and 'n' were 555 and 901, so to decode:

387555 % 901 = 89, getting back our first number, and translating it back into "HI".

So, yeah, cryptography and RSA in a nutshell. It might be a little beyond the scope of an 11-year-old, but hope this helps out. Your site is pretty cool and I'd definitely be interested in how it turns out.

Anyone know if jquery cycle affects z-index? by bitterorcain webdev

[–]Mandatory 1 point2 points ago*

sorry, this has been archived and can no longer be voted on

I haven't used jQuery cycle before, but taking a look at the plugin, it does seem to set the z-index for all of the slides before animating the slideshow:

 // set position and zIndex on all the slides
$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
    var z;
    if (opts.backwards)
        z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
    else
        z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
    $(this).css('z-index', z)
});

So setting the z-index in the CSS for the slides isn't going to change anything.

EDIT:

I took a look at your actual code. jQuery cycle changes the positioning for the slides to be 'absolute'. Your overlaying image has a positioning of 'relative'. Z-index only works when the objects in question are inside the same stacking context, so they both need to have the same position to function properly. Change the CSS of your overlaying image to be 'position: absolute' and it should work then.

Going to college for Compsci but do not know squat about Compsci/programming... What should I learn first? by wondertwinsin compsci

[–]Mandatory 0 points1 point ago

sorry, this has been archived and can no longer be voted on

I have friends at CMU, I believe they switched to Python for the introductory course sometime in 2010. Here's one of their sample course syllabi for that year:

http://www.cs.cmu.edu/~jxc/100.html

Wallpaper I made for a fellow redditor by evilrevolutionin comics

[–]Mandatory 7 points8 points ago

sorry, this has been archived and can no longer be voted on

New Batwoman's into girls.

Don't know if this is a disappointment for you or makes it even better.

Wallpaper I made for a fellow redditor by evilrevolutionin comics

[–]Mandatory 80 points81 points ago*

sorry, this has been archived and can no longer be voted on

From left to right:

I could be wrong on a few of this, I'm not master-tier Batman guru yet. Anyway, this is really amazing artwork!

EDIT: Wikipedia links! Batman knowledge for everyone!

looking for a DIV creator by fathersummaryin web_design

[–]Mandatory 0 points1 point ago

sorry, this has been archived and can no longer be voted on

Using CSS3 guidelines (so add webkit- or moz- prefixes, preferably both, in front of all of these) for everything.

Rounded corners:

border-radius: [radius size of each corner]

Drop shadows:

box-shadow: [inset?] [shadow sizes] [color]

Rotation:

transform: rotate( [degrees] )

CSS3 has basically taken all of the difficulty in doing these effects out of the picture completely. Like Remnants said, you should know how to do these (with the pre-CSS3 original methods too for IE and other browsers) if you want to really do web design.

TIL if you add http://bacolicio.us// to the beginning of a web address it will add a large piece of bacon to your browsing experience by protellin todayilearned

[–]Mandatory 3 points4 points ago

sorry, this has been archived and can no longer be voted on

I like how all of those PETA girls are staring longingly at the bacon, like it's like nothing they've seen before.

Hey webdev! I created a little framework to get small static websites up and running quickly! by dahlmain webdev

[–]Mandatory 3 points4 points ago

sorry, this has been archived and can no longer be voted on

This is a pretty cool idea, but forcing humans to edit XML is pretty harsh...

Would you be able to change it to something more human readable, say Markdown, or something?

Is there a way to do nested formsets in django? by sontekin django

[–]Mandatory 0 points1 point ago

sorry, this has been archived and can no longer be voted on

There's a jQuery plugin you can use that easily integrates with Django. See:

http://dewful.com/?p=100

This uses jQuery Dynamic Form, which is really useful for that type of thing.

I'm looking for a plugin that extends the functionality of forms but can't think that it's called :| by johnyma22in jquery

[–]Mandatory 0 points1 point ago

sorry, this has been archived and can no longer be voted on

I did something like this before with Django and jQuery, but I don't think it's possible with just jQuery alone. Here's a really good tutorial on how to do it if you're interested though:

http://dewful.com/?p=100

Working recordable (html5?) Guitar on google today, for Les Paul by mitchwellsin web_design

[–]Mandatory 1 point2 points ago

sorry, this has been archived and can no longer be voted on

Oh, whoa, you're right, guess I'm a bit behind on my browser knowledge. :P

It's IE that doesn't really support <audio> yet, of course.

Working recordable (html5?) Guitar on google today, for Les Paul by mitchwellsin web_design

[–]Mandatory 4 points5 points ago

sorry, this has been archived and can no longer be voted on

Movement of the strings seems to be Javascript-based, but the sound player is a Flash object. Makes sense since no browser really supports <audio> yet.

I built this app to help Vocab learning. Help review. by ramiyerin design_critiques

[–]Mandatory 0 points1 point ago

sorry, this has been archived and can no longer be voted on

Screenshots taken with a throwaway Facebook account

My opinions:

Design-wise it's pretty good for a Facebook app. I would change the table you have for "Spread the Word" into possibly just a single button somewhere though, and have something else instead. There's no point in having that take up so much space.

Some of the smaller words are illegible on my screen (1600 x 900, 17" screen), so I assume it's only going to be only harder to read for smaller laptops. Increasing the size of the words would definitely help, or have an option to change font size.

Functionality-wise, there's a lot that probably needs to be done before people will use it. It serves basically the same purpose as flashcards right now, which isn't that bad, but unless there's something unique that makes it better than pen + paper, I think it might be hard to get people to use it.

I guess the point of your app is so that a lot of people can contribute different answers to a question, so on that note, how are you planning on moderating/making sure those answers are correct?

Hope this helps, I tried to be as honest as I could, but it does seem like a good idea. Good luck!

Mapnificent shows you the places in your city that you can reach in a given amount of time using public transit. by andrewinmelbournein programming

[–]Mandatory 0 points1 point ago

sorry, this has been archived and can no longer be voted on

r/programming isn't for demoing your app.

That said, though, your API is pretty cool, I'd love to hear more about what you can do with it.

Removing .html from your urls. I can't find a guide that I understand. Can anyone here help? by comfybearin web_design

[–]Mandatory -3 points-2 points ago

sorry, this has been archived and can no longer be voted on

Two main reasons I can think of, both related to each other:

  1. You might not be using .html in a few years' time. Say OP decides to switch his site to PHP. He'll still want the link he had before to be valid.

  2. Search engine wise, it's better to keep your links without file extensions, since having additional information that has nothing to do with the content of your site (the 'html') can actually affect your page ranking.

Removing .html from your urls. I can't find a guide that I understand. Can anyone here help? by comfybearin web_design

[–]Mandatory 1 point2 points ago*

sorry, this has been archived and can no longer be voted on

As your site gets bigger and bigger, having a separate directory for each individual page would become absolutely ridiculous. I guess for just small, static sites, it wouldn't be much of an issue, but for larger sites (with subpages within subpages), you would have way too many directories to manage.

Also, since each page would be named index.html, it would be a huge pain in the ass to figure out which page was what outside of the directory structure.

.htaccess is just easy to use and adaptable to many more things (especially if you start making dynamic sites with PHP or something later on).

Removing .html from your urls. I can't find a guide that I understand. Can anyone here help? by comfybearin web_design

[–]Mandatory 3 points4 points ago

sorry, this has been archived and can no longer be voted on

Just did a quick Google search for them, and they do provide .htaccess support, but you will have to raise a ticket with them before they give you the permissions to change it. Hope it works, and if not, coryski's method will work, but I wouldn't recommend it.

Removing .html from your urls. I can't find a guide that I understand. Can anyone here help? by comfybearin web_design

[–]Mandatory 0 points1 point ago

sorry, this has been archived and can no longer be voted on

Who is your hosting provider? Most hosting providers do provide .htaccess support, but I know several pretty basic ones won't. If you can't, then unfortunately, there's not much you can really do about it.

Removing .html from your urls. I can't find a guide that I understand. Can anyone here help? by comfybearin web_design

[–]Mandatory 19 points20 points ago

sorry, this has been archived and can no longer be voted on

The proper method to do so is to use .htaccess. Make a file in your directory root called .htaccess and have the following inside:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

This will rewrite all of your html files to show no file ending in the URL. Note that the server you're doing this on, if it runs Apache, would need mod_rewrite, but most shared hosting nowadays does have it. Hope it helps!

Most annoying language or dialect? by [deleted]in AskReddit

[–]Mandatory 1 point2 points ago

sorry, this has been archived and can no longer be voted on

First example I thought of: Bus Uncle - Youtube link here

He's actually not that angry at the beginning of the clip, even though it might sound like it to non-speakers. Actual Cantonese angriness only starts around 2:15.

I know this girl . . . should I try to get her to do an AMA?Anyone interested? by snorky94in IAmA

[–]Mandatory 1 point2 points ago*

sorry, this has been archived and can no longer be voted on

http://www.lawsofconservation.com/5.html

Look at her biography, apparently she's an eighth grader in the "International Academy of Genius".

Her so-called "paper"

This also seems to be absolute bullshit peppered with scientific buzzwords. Particular hilarity goes to the ridiculous description of the mathematical formula (especially for anyone that has studied anything remotely close to fluid mechanics), how they randomly capitalize things to make them sound important, and the completely random application of Occam's Razor.

Like srgmpdns said, this is multi-syllabic words masquerading as real science.

Gary Mother Fuckin' Oak by ButteryChrisontin gaming

[–]Mandatory 77 points78 points ago

sorry, this has been archived and can no longer be voted on

The "Fuck yeah :3" Eevee makes the picture.

Reddit, what are some little mneumonics or helpful learning tips that you learnt in school that you still use today? by dum-di-dumin AskReddit

[–]Mandatory 2 points3 points ago

sorry, this has been archived and can no longer be voted on

(Drunken) Katy Perry Came Over For Great Sex

Much, much easier to remember IMO.

By request, I've created a script to download IAmAs as pdf files. by Chunin IAmA

[–]Mandatory 0 points1 point ago

sorry, this has been archived and can no longer be voted on

This is really awesome. Just curious, do you just go through the entire JSON file for comments or is it optimized in any way?

view more: next