0/1 knapsack problem dynamic programming

Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.Drawing graphint[] plot(int[…

Palindrome

Definition of Palindromeleft-to-right, and right-to-left, and it’s the same.“A man, a plan, a canal - Panama!”AbbaSolutionYou need 2 pointers, one at the beginning, another one in the end. Move them one by one towards the center and check if it's palindrome.boolean check(String text) { int a…

SSL/TLS cipher suite

A cipher suite specifies one algorithm for each of the following tasks:Key exchangeBulk encryptionMessage authenticationSo you may see something like: PSK-AES-SHA256Key exchange algorithmsKey exchange algorithms protect information required to create shared keys. These algorithms are asymmetric (public key algorithms) and perform well for relatively small amounts of data.ExamplesWe…

Difference between SSL and TLS

SSL is the predecessor to TLSSSL 1.0 was never released to publicSSLv2 in 1995, deprecated in 2011 (link)SSL v3 in 1996, deprecated in 2015 (link)TLS 1.1 in 1999TLS 1.2 in 2008TLS 1.3 currently in draft (link)References:https://www.globalsign.com/en/blog/ssl-vs-tls-difference/…

Digital certificate life cycle and validating

What is certificateA electronic document with the following infoWho issued the certificateWho the certificate is issued toValid to date (expiry date)Public keyDigital signatureHash value of the certificate, used private key to sign the key -> digital signatureTo validate, apply public key to digital signature to get back the…

Network layers

The seven Open Systems Interconnection layers are:Layer 7: The application layer. ...Layer 6: The presentation layer. ...Layer 5: The session layer. ...Layer 4: The transport layer. ...Layer 3: The network layer. ...Layer 2: The data-link layer. ...Layer 1: The physical layer.References:https://searchnetworking.techtarget.com/definition/OSI…

TLS Handshake

It happens in all HTTPS connections.Certificate phase, chose cipher suiteClient send hello, with supported cipher/version all other informationServer send hello, with certificate, and done helloPremaster key doneSymetric key exchange using asymetric public key in certificateComputer installed many CA Client send we use client keyNow they are talking, with…

Welcome to Ghost

Hey! Welcome to Ghost, it's great to have you :) We know that first impressions are important, so we've populated your new site with some initial Getting Started posts that will help you get familiar with everything in no time. This is the first one! There are a few things that…