Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web.
|
2006-02-10 The charm of Sun's Freeware collectionPresented on a stock install Solaris 9:
$ cat hello.cpp
#include <iostream.h>
main()
{
cout << "Hello World!\n";
}
$ g++ hello.cpp
$ ./a.out
ld.so.1: a.out: fatal: libstdc++.so.2.10.0: \
open failed: No such file or directory
Killed
(Line wrapping added for clarity.) To get the Sun Freeware g++ working, the magic solution is ' The irony here is that the Sun Freeware g++ has already been
configured to look in If I have to use g++ on Solaris much, I expect I'll just write a cover script for gcc and g++ that just always adds that argument. (Or replace the g++ version entirely, since it is gcc 2.95.3.) Update: courtesy of the htdig FAQ,
another workaround is to set the (2 comments.)
solaris/SunFreewareCharm written at 16:03:26; Add Comment
Session IDs and the Birthday ParadoxIf you have a database (or in general some writable store), the best way to do authentication in a web app is with session ID cookies. Every time someone logs in, you pick a large random number to be their session ID, give them a cookie with the session ID, and then store all of the details in your database under the session ID. When they come back, you get the session ID cookie, look it up in the database, make sure it's (still) valid, and go. What prevents attackers from getting in is the difficulty of guessing
a usable session ID. So, assuming you're using a good random number
generator such as This is a slight variant on the 'Birthday paradox' problem. With
(call this p(N, M).) To start with, let's say that you expect three million valid session IDs at a time; this might seem extreme, but LiveJournal currently has two million active users. I've made a handy little table of results:
(Disclaimer: I think I, and Python, got the math right. Please feel free to correct me if I didn't. '~ 0%' means 'so small that it prints as 0'; the collision chance is clearly never literally 0.) So 72 bits (9 bytes) should be pretty durn safe. It even remains safe at 30 million valid session IDs, which is a pretty good sign that people trying to guess valid session IDs will be there for a long, long time. If you expect 300 million valid session IDs, you'll want to go to more bits. On most modern systems, the easy way to get this much good randomness is
just to read however many bytes you need from More probability and mathNow, this isn't quite the answer to the question I posed at the start, which I can rephrase as:
The figures I gave are somewhat of a handwave about, effectively,
p(N+R, M), which is more or less the same as p(N, M) if A friend pointed out that this is just the probability of making
(Update: actually the terms should run only to (M-(R-1)).) However, computing this for large I think p(N+R, M) - p(N, M) might be close, although that sort of overcounts by roughly p(R, M) (since the attacker's values will be non-colliding if the attacker has any brains). Sidebar: giving everyone on earth a randomly assigned unique IDLet's assume that we wanted to randomly assign everyone on earth a numeric ID, and be relatively sure that there were no collisions. How large a bit space would we need? To have a margin for error, let's use a world population figure of ten billion.
(These figures are from (3 comments.)
programming/SessionIDsAndBirthdayParadox written at 01:52:27; Add Comment
|
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |