HTTP, TCP/IP and …

HTTP The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, and hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web. HTTP is an application layer protocol designed within the framework of the Internet protocol suite. Its definition presumes an underlying and reliable transport layerprotocol, and Transmission Control Protocol (TCP) is commonly used. However HTTP can be adapted to use unreliable… Continue reading HTTP, TCP/IP and …

Advertisements

HMAC

  The hash is generated by the client using the client specific secret key using the hash_hmac inbuilt method.  This hashed value is included in the request header. Request which include this hash value also have a time stamp field set. The server generates it's own hash based on the request content and the client specific key(… Continue reading HMAC

CSRF

Read this. According to the Microsoft Developer Network, HttpOnly is an additional flag included in a Set-Cookie HTTP response header. Using the HttpOnly flag when generating a cookie helps mitigate the risk of client side script accessing the protected cookie (if the browser supports it). In computing, the same-origin policy is an important concept in the web application security model. Under the policy,… Continue reading CSRF

Shuffle an array

The general method for shuffling is biased. Check this - https://spin.atomicobject.com/2014/08/11/fisher-yates-shuffle-randomization-algorithm/ and http://www.i-programmer.info/programming/theory/2744-how-not-to-shuffle-the-kunth-fisher-yates-algorithm.html When shuffling the maximum number of possible outcome can't be more then n!( n is the number of items being shuffled). So if the algo generate more then n! possible outcome then the algo is biased. The Knuth Fisher-Yates Algorithm produces unbiased shuffled outcome. It… Continue reading Shuffle an array

UUID

How is UUID unique(version 1 ) There is more than one type of UUID, so "how safe" depends on which type (which the UUID specifications call "version") you are using. Version 1 is the time based plus MAC address UUID. The 128-bits contains 48-bits for the network card's MAC address (which is uniquely assigned by… Continue reading UUID

Stack vs Heap

Link Stack: Stored in computer RAM just like the heap. Variables created on the stack will go out of scope and automatically deallocate. Much faster to allocate in comparison to variables on the heap. Implemented with an actual stack data structure. Stores local data, return addresses, used for parameter passing Can have a stack overflow… Continue reading Stack vs Heap