![]() |
![]() |
|
May 13, 2003Light on, Light Off, Light On.. you get the pictureAhhh, the power of the electron. Information is nothing more than 1's and 0's. On or off. Alive or dead. As a programmer I sometimes feel like an artist, sculpting binary data into a great work of art, designed to solve some sort of problem. Then again, some days I think all I am doing is welding a couple of beer cans together and calling it 'cultural art'. Other people do that for a living. They are typically called PHP scripters. You get the picture. Anyways, today was a pretty good day at work. I finally got around to doing fast low level bitwise ops on raw memory to quickly be able to determine if an IP address is within a subnet range. I ended up with some clean, and somewhat easy to understand code that looks something like this:
network = raw_range & mask; broadcast = network | ( 0xFFFFFFFF & ( 0xFFFFFFFF ^ mask ) ); if( ip > network && ip < broadcast ) You get the idea. Those three little lines save tonnes of iterations and function calls by simply accessing pointers to raw memory.. and is required since I don't have access to any user mode libs that do this for me. Then again, being that I rolled my own its also got the benefit of being faster, and smaller than some monolithic library or module. I have to admit this has been kinda fun. It's nice when you accomplish something like this without the need for a vendors library or built in API. I think we rely to much on other people's code and use the blanket statement of 'code reuse' without really understanding the implications of it. Come on, I know some really bright developers who are perl module sluts (/me waves to Wim) and rely on stuff that is already out there. This is actually a great way to get things out fast, and has its place. But it doesn't mean that from a quality point of view that its better... or worse... Atleast, not until you start writing kernel-mode code, and you realize you can't rely on such things, and you need to go back to the raw basics at the bare metal. Now I realize WHY operating systems, compilers and drivers are written in C, and C alone. Yes, I am nuts. I just I hope I don't end up with any ticks or looking like many other kernel developers Alan has commented on recently. |
![]() ![]()
My 5 Favorite Books
Writing Secure Code
Secure Programming Cookbook Security Engineering Secure Coding Principles & Practice Inside the Security Mind ![]()
My 5 Favorite Papers
Smashing the Stack
Penetration Studies Covert Channel Analysis of Trusted Systems DoD Trusted Computer System Evaluation Criteria NSA Security Recommendation Guides ![]()
Archives
December 2005
November 2005 October 2005 September 2005 August 2005 July 2005 June 2005 May 2005 April 2005 March 2005 February 2005 January 2005 December 2004 November 2004 October 2004 September 2004 August 2004 July 2004 June 2004 May 2004 April 2004 March 2004 February 2004 January 2004 December 2003 November 2003 October 2003 September 2003 August 2003 July 2003 June 2003 May 2003 April 2003 March 2003 February 2003 January 2003 December 2002 November 2002 October 2002 September 2002 August 2002 July 2002 ![]() |
|