<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Robert Lin on Medium]]></title>
        <description><![CDATA[Stories by Robert Lin on Medium]]></description>
        <link>https://medium.com/@berto168?source=rss-84a32eaca4c8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JNvPvCqj3-CKyrf5I8BuRg.jpeg</url>
            <title>Stories by Robert Lin on Medium</title>
            <link>https://medium.com/@berto168?source=rss-84a32eaca4c8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 23:48:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@berto168/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Glimpse into Big Data]]></title>
            <link>https://medium.com/@berto168/a-glimpse-into-big-data-2c5a9874c7bb?source=rss-84a32eaca4c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c5a9874c7bb</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[big-data]]></category>
            <dc:creator><![CDATA[Robert Lin]]></dc:creator>
            <pubDate>Tue, 17 Jan 2017 19:25:49 GMT</pubDate>
            <atom:updated>2017-01-17T19:25:49.139Z</atom:updated>
            <content:encoded><![CDATA[<p>Big Data. I’m sure it’s a term that you’ve heard floating around the tech industry. What is it exactly? Here I’ll take a shallow look into what big datais and what it’s about.</p><h3>What is it?</h3><p>Big data describes large and possibly complex sets of structured or unstructured data that can be analyzed for patterns, trends, and other associations. This data is all around but must be computationally parsed in a significant way that it can be properly utilized, today’s challenge.</p><p>Rob Goldstein, COO and Global Head of BlackRock Solutions, describes the challenge with big data as the “data now available and the computing power to analyze that data”. For example, BlackRock, a global leader in investment firms, must leverage big data analysis to help guide informed investment decisions for over $5.1 trillion in assets, not a feat to be taken lightly.</p><h3>Example?</h3><p>Let’s take a look at a hypothetical (but practical!) case of big data utilization. Say it’s the holiday season and a new video game is selling quickly. Before big data was largely implemented, the retailers who reacted the fastest and purchased more inventory had the advantage. Nowadays, retailers use big data analysis to better prepare for what they should stock up on in time for the holiday season. SmartShop is a (fake) retail store that also has an e-commerce presence.</p><p>Savvy retailers can utilize “web browsing patterns, social media, industry forecasts — to predict trends [and] prepare for demand”. By making the correct predictions based on market metrics, smart retailers will never sell out of the hottest items and risk losing out of potential profit. SmartShop can also find out <em>where</em> demand would be greatest such as brick-and-mortar stores or warehouses for online sales distribution based on search history, in-store inquiries, sales trends, etc. By predicting trends and shipping more video games through the right channels, SmartShop has turned a huge profit for the holidays! <a href="http://www.ibmbigdatahub.com/presentation/big-data-retail-examples-action">http://www.ibmbigdatahub.com/presentation/big-data-retail-examples-action</a></p><p>The potential use of big data runs the gamut and is not just limited to retail stores. Data lies in everything and how you harness that information is vital. A quick example was how BlackRock Solutions was utilizing satellite imagery of shopping center parking lots to analyze customer volume and traffic at different times of the day as another data point indicator of the financial strength of an investment property. This sort of out-of-the-box thinking is a clever and innovative way to take data that exists and parse it in a way that can be helpful.</p><h3>Three V’s (and more?)</h3><p>There are 3 V’s to remember when it comes to big data.</p><p><strong>Volume</strong> refers to the sheer amount of data. It is ever expanding and growing as each day passes. It is estimated that by 2020, there will be 40 Zettabytes (40 trillion gigabytes) of data created and stored.</p><p><strong>Variety</strong> relates to the number of types of data and the different forms they take. It ranges from tweets, to videos, to photos, to news articles, each of which require different methods or tools to analyze. It is an important part of big data due to the constantly changing landscape of the world.</p><p><strong>Velocity</strong> refers to the speed in which the data is created, stored, analyzed and visualized. The NYSE captures 1 TB of trade information during each trading session.</p><p>Where the three V’s intersect exemplifies the many facets of big data and the challenges that come with analyzing and creating solutions for the vast (volume) amount of diverse (variety) data, quickly (velocity) and effectively as data continues to grow.</p><p>And while Volume, Variety, and Velocity can help us begin to understand what big data can help us achieve, there are many other factors that we should look at. Veracity refers to how the actual data is truthy and relevant. It’s no good to us if the big data we analyze leads us down the incorrect path. And finally, Value may be the most important attribute to big data analysis. How valuable is the analysis? How much value does it bring to have this information?</p><blockquote>Big data encompasses information from multiple internal and external sources such as, transactions, social media, enterprise content, sensors and mobile devices. Companies can leverage data to adapt their products and services to better meet customer needs, optimize operations and infrastructure, and find new sources of revenue.</blockquote><p><a href="http://www.ibmbigdatahub.com/infographic/four-vs-big-data">The Four V&amp;#039;s of Big Data</a></p><p>The world is surrounded by data. How we analyze that data continues to be a challenge to this day. However, leveraging big data is the key to growth and success not only for a company, but also for the world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c5a9874c7bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JWT — The Basics and more]]></title>
            <link>https://medium.com/@berto168/jwt-the-basics-and-more-63e7f1fc43c6?source=rss-84a32eaca4c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/63e7f1fc43c6</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[jwt]]></category>
            <dc:creator><![CDATA[Robert Lin]]></dc:creator>
            <pubDate>Thu, 01 Dec 2016 08:06:01 GMT</pubDate>
            <atom:updated>2016-12-01T14:39:35.268Z</atom:updated>
            <content:encoded><![CDATA[<p>JWT (pronounced ‘jot’) stands for JSON Web Token. It is defined in the standard RFC7519 published in May 2015. It is used to securely communicate JSON objects. Let’s dive into what a JWT is made of and why it’s important!</p><p>Here’s what a JWT consists of:</p><pre>Header.Payload.Signature</pre><p>Wow! So simple, right?</p><p>A <strong>Header</strong> typically consists of two things, the type of token and the hashing algorithm:</p><pre>Header = { &quot;typ&quot;: &quot;JWT&quot;, &quot;alg&quot;: &quot;HS256&quot; }</pre><p>“JWT” here stands for JSON Web Token, as you can imagine. “HS256” stands for HMAC-SHA256 algorithm, a symmetric algorithm that uses a single secret key for the <strong>Signature</strong>. There are many other algorithms that can be used but other common ones include RSASSA-PKCS1-v1_5 + SHA256 (RS256) and ECDSA + P-256 + SHA256 (ES256), both which are asymmetric meaning they use a public/private key pair. There is also a “none” value available for “alg” which has been discovered to <a href="https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/">expose vulnerabilities in some JWT libraries</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eciHIXZHL0AsryuR2lgk2g.png" /><figcaption>Look at all these algorithms that JWT’s can use!! BEWARE OF “none” though!</figcaption></figure><p>The <strong>Payload</strong> contains the actual data and is also referred to as claims. An example is shown below with various bits of info in the object:</p><pre>Payload = { &quot;user_id&quot;: &quot;0916&quot;, &quot;admin&quot;: true, &quot;iss&quot;: &quot;robert.com&quot; } </pre><p>There are three types of claims, reserved, public, and private. For the most part, public claims are used as they are defined by those using JWT’s. Reserved claims include <strong>“iss”</strong> for the issuer of the token, <strong>“aud”</strong> for the audience that the JWT is intended for, <strong>“sub”</strong> for the subject, and <strong>“exp”</strong> for the expiration time. They utilize three letters to keep the JWT compact. Private claims are custom claims that are agreed upon between the parties. However, you’re warned that they are subject to collision (when claim names match) and should be used with caution.</p><p>The <strong>Signature</strong> takes the encoded <strong>Header</strong> and encoded <strong>Payload</strong>, a secret key known only to the producer of the JWT (our server), the hash algorithm (i.e. HMAC-SHA256), and signs it.</p><pre>signature = HMACSHA256(<br>    base64UrlEncode(Header) + &quot;.&quot; + <br>    base64UrlEncode(Payload), <br>    &quot;some_secret_key&quot;<br>);</pre><p>What’s happening is the <strong>Header</strong> and <strong>Payload</strong> are encoded and joined with a “.”. Then, both encoded bits of info are then hashed with our HS256 algorithm and our secret key so aptly name “some_secret_key” to produce the signature. They all combine to form our JSON Web Token (actually encoded with <a href="https://jwt.io/#debugger">https://jwt.io/#debugger</a>)! This JWT can now be easily passed through HTML and HTTP environments.</p><pre>base64UrlEncode(Header) =&gt; eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9</pre><pre>base64UrlEncode(Payload) =&gt; eyJ1c2VyX2lkIjoiMDkxNiIsImFkbWluIjp0cnVlLCJpc3MiOiJyb2JlcnQuY29tIn0</pre><pre>signature =&gt; HWmfTFIMIgCym7sVsH7O4SvCpqS5hvBi50Z_tNV9F7Q</pre><pre>JWT = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMDkxNiIsImFkbWluIjp0cnVlLCJpc3MiOiJyb2JlcnQuY29tIn0.HWmfTFIMIgCym7sVsH7O4SvCpqS5hvBi50Z_tNV9F7Q</pre><p>Now the server just needs to provide the client with the JWT for future use. The client can now send this JWT along with its API requests to the server. Instead of having to authenticate a login, the server decodes the JWT (with its secret key) and verifies the identity of the client.</p><p>Here’s a simple analogy for what JWT is and how this validation process works. You’re a VIP going to concert of your favorite band. Your credentials are yourself and your ID (much like a username and password). The venue and the staff (server) have a guest list that contains your name on it (database). After presenting your credentials, you are given this magical wristband that proves your identity has been checked to the list and verified (JWT). You no longer need to be verified again since there is no other way to obtain these magical wristbands, and you are free to walk in and out of the venue until the concert has ended (JWT expiration — “exp”).</p><p>Why is this significant? It allows the server to verify the information within the JWT without having to store much. The server stores a <strong>single secret key</strong> in its database that is used to issue new tokens (encoding/encrypting) and decode all incoming JWT’s. This provides scalability as the server can respond faster to authentication requests; it doesn’t matter if you have one or one million users logged in at the same time, the same secret key will be used for authentication. This is in contrast to a traditional method of storing and creating a record in the database for every single user which means unique keys for each.</p><p>Do you ever need to change the secret key? This is a question I really pondered. Ideally you wouldn’t have to change the secret key because it’s secret and should be secured as most secret things are. A change in the key would require all users to be logged out (which sounds like a server reset of sorts to me) as the old issued JWT’s of users would be invalid with a new secret key.</p><p>The significance of these asymmetric algorithms are honestly a bit puzzling to me still, but it seems like the main reason to use asymmetric algorithms is when the origin of the JWT is important. In a public/private key scenario, only the issuer of the JWT has the private key to encode and encrypt while the public key is known to the outside. Thus, only the side with the private key can sign while everyone else has the ability to validate the signature with the public key. This way you know the issuer is legitimate as they are the only ones with the private (secret) key.</p><p>Here are some random things I noticed while learning about JWT. First, they are quite often referred to as JWT tokens. This practice suffers from RAS syndrome or “Redundant Acroynym Syndrome Syndrome” (HA!) as the “T” in JWT stands for Token. Calling it a JWT token is just like saying ATM machine or PIN number. Secondly, JWT is an acronym within an acronym (OMG Acronym-ception)! <strong>JWT</strong> stands for <strong>J</strong>SON <strong>W</strong>eb <strong>T</strong>oken and <strong>JSON</strong> itself stands for <strong>J</strong>ava<strong>S</strong>cript <strong>O</strong>bject <strong>N</strong>otation. Unfortunately JavaScript Object Notation Web Token is quite a mouthful so let’s just stick with “jot” 😀.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63e7f1fc43c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Inheritance or Composition?]]></title>
            <link>https://medium.com/@berto168/inheritance-or-composition-9518f6d42fd0?source=rss-84a32eaca4c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9518f6d42fd0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Robert Lin]]></dc:creator>
            <pubDate>Thu, 10 Nov 2016 06:58:44 GMT</pubDate>
            <atom:updated>2016-11-10T06:58:44.943Z</atom:updated>
            <content:encoded><![CDATA[<p>In Object-Oriented Programming, objects are a tool used as a container of data. In Ruby, we use classes as a blueprint and factory for our objects. Classes can then inherit methods or behaviors from another class which allows our objects to reuse code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d163c0f28636a367b5eb51bdc079be16/href">https://medium.com/media/d163c0f28636a367b5eb51bdc079be16/href</a></iframe><p>As you can see above, we’ve defined a Animal class that can <em>#eat</em> and <em>#breathe</em>. We’ve also defined a Dog class that inherits the behavior of an animal, but has its own method to <em>#bark</em>. You can imagine a Cat class that will inherit the <em>#eat</em> and <em>#breathe</em> while also having a <em>#meow</em> method.</p><p>Okay, great! What else is new?</p><p>While inheritance allows us to reuse code for objects within similar groups, we can run into issues down the line. Let’s say now we have to create a Robot-Dog hybrid that needs to <em>#bark</em> and <em>#lasershow, </em>but doesn’t need to <em>#eat</em> or <em>#breathe</em>? Now we run into a hierarchical problem. How will our Dog inherit from both classes? Do we create a separate Robot-Animal class?</p><p>This is where composition really shines. In JavaScript, there are Object prototypes that define behavior. The prototype is an instance of object that other objects can then inherit that behavior from. However, unlike Ruby classes where <em>inheritance brings in all methods</em>, you can <strong><em>compose</em> </strong>an object in the way that you need to.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e245e301f45802685f7114877884d04a/href">https://medium.com/media/e245e301f45802685f7114877884d04a/href</a></iframe><p>Here we have separate objects (eater, breather, barker, lasershower) that have a method defined. We then create a dog or robotDog object and assign these other objects and combine the functionality we want. This allows objects to be more independent from each other and prevents coupling issues with a fragile base class. With class inheritance, all dogs can only <em>#bark</em> in the same way. If we changed it for one subclass of dog, the others would get affected. If we added in a <em>#yelp</em> method, <strong><em>all dogs would inherit it</em></strong> even if a subclass of dog doesn’t <em>#yelp</em>.</p><p>JavaScript’s prototype-based inheritance is not subject to the flaws of class inheritance. It allows for more flexibility and will not limit you to a taxonomical or hierarchical problem.</p><p>The idea is simple. In inheritance, objects are designed based on what they are whereas in composition, objects are designed based on what they do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9518f6d42fd0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monolithic vs Modular]]></title>
            <link>https://medium.com/@berto168/monolithic-vs-modular-9b6d69684a2c?source=rss-84a32eaca4c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b6d69684a2c</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Robert Lin]]></dc:creator>
            <pubDate>Thu, 03 Nov 2016 05:11:52 GMT</pubDate>
            <atom:updated>2016-11-03T05:11:52.881Z</atom:updated>
            <content:encoded><![CDATA[<p>Now that we’ve begun to learn JavaScript and Node.js, it’s time to look into the terms “monolithic” and “modular” in regards to frameworks and libraries. An example of a monolithic framework is Angular.js by Google. An example of a modular framework is Ampersand.js. Let’s begin with some comparisons between the two that can help us distinguish the differences in what they provide.</p><h3>A brief description:</h3><p><strong>Monolithic:</strong> a monolithic framework typically provides a tightly coupled codebase that makes a lot of assumptions about how the code interacts with each other. It usually includes everything you would need to get a web application up and running quickly.</p><p><strong>Modular: </strong>as you can guess a modular framework is more minimal and only provides the barebones functionality and structure for your application. Generally only has one “responsibility”. The code is more loosely couple where each part of code communicates in a more or less standard interface.</p><p>What does tight or loose coupling mean? Coupling refers to how much code relies on each other, their independence from other code. Tightly coupled code has a higher interdependency but offers more coordination (as the code “knows more” about each other). Loosely coupled code, as you can imagine, has lower interdependency, but offers less coordination (not necessarily worse by any means). What this means is that loosely coupled code rarely needs to be changed because it’s written and designed to interact with other parts of code on a very independent level. It also means that changes to certain code will have less effect on other parts, one of the advantages of modular frameworks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5DdrCxwybv-s-gGCYnPa8g.png" /><figcaption>So much JavaScript</figcaption></figure><h3>Advantages/Disadvantages:</h3><p><strong>Monolithic:</strong> as mentioned before, a monolithic framework may be easier to hit the ground running quickly. It makes many assumptions and provides standardized code that interacts very well within its own codebase. Its tighter structure allows for that.</p><p>However, you have less control over how you want your code to look or what you want it to do. That is, a monolithic framework is very “opinionated” in how something should be done. It’s more rigid. Debugging becomes more difficult with a monolithic framework as well. The code is an inherent part of the framework. Replacing it with a workaround can be very expensive and risky as you have to understand the codebase extremely well. Long term maintenance becomes an issue as you either have to replace the entire framework if it’s not fitting your needs (of something such as scalability) or find developers who either know the language of your specific framework or have to be taught entirely. Because replacing your entire framework likely comes with a lot issues, you may just be stuck with what you have.</p><p><strong>Modular: </strong>modular frameworks provide code that is more reusable and it fits the definition of modularity perfectly. The code is organized independently and can be easily swapped in and out. If certain code is broken, you don’t have to spend a lot of time searching for the bug as it’s easier to locate the source. Having a spread out distribution of code allows for better maintainability in the long run. If there is something that does not work as you like, you can swap in another framework that suits your needs. You have more control over your codebase.</p><p>A disadvantage of using modular frameworks is that it may be harder initially to get your project started. Modular frameworks don’t provide enough out-of-the-box to build a web app right away.</p><blockquote>When you choose a framework, you make a large, long term commitment. You sign up to learn about the framework’s various inner workings and strange behaviors. You also sign up to a period of ineffectiveness whilst you’re getting to grips with things. If the framework turns out to be the wrong bet, you lose a lot. But if you pick and choose from libraries, you can afford to replace one part of your front end stack whilst retaining the rest. — Jimmy Breck-McKye, <a href="http://www.breck-mckye.com/blog/2014/12/the-state-of-javascript-in-2015/"><em>The State of JavaScript in 2015</em></a>,</blockquote><p>In the short term, a monolithic framework can provide you everything that you need to start fast. It could be advantageous to have a working application out early. If your app is small, monolithic can be the way to go. However, in the long term, if you foresee larger growth and scaling, it seems utilizing modular frameworks to build an application is the better choice, providing you more choice and maintainability.</p><p>Source: “Monolithic vs. modular — what’s the difference?” — joepie91 (<a href="https://gist.github.com/joepie91/7f03a733a3a72d2396d6">https://gist.github.com/joepie91/7f03a733a3a72d2396d6</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b6d69684a2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Salt & Pepper: Spice up your hash!]]></title>
            <link>https://medium.com/@berto168/salt-pepper-spice-up-your-hash-b48328caa2af?source=rss-84a32eaca4c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b48328caa2af</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[passwords]]></category>
            <dc:creator><![CDATA[Robert Lin]]></dc:creator>
            <pubDate>Thu, 27 Oct 2016 05:22:42 GMT</pubDate>
            <atom:updated>2016-10-27T05:22:42.420Z</atom:updated>
            <content:encoded><![CDATA[<p>As much as I would love this to be about seasoning a beloved breakfast staple, there is something more to salt and pepper. Salt and pepper both refer to data that is generated and appended to some other data (in most cases a password) before its combined result is passed through a cryptographic hash function that outputs digested data that is nigh impossible to revert.</p><p>Whoa, whoa, whoa.. slow down!! What is happening here?! Let’s take a step back and talk about a cryptographic hash function and why it’s needed. The internet is one big digital world that stores a ton of information everywhere. And just like our real world some data needs to be securely locked up so only the right people can access it. We’re all used to having to log into a website with our username and a password. The password acts just like a key in that it provides only those with the correct key access to the secured data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IDBnmphH0FMP77HZTpShjg.png" /><figcaption>This door leads to all of my secrets.</figcaption></figure><p>Well how does a web server know that we’ve entered the correct password? It has to somehow verify what we’ve typed in. If they stored our username/password combination, that would work, wouldn’t it? Yes, it would absolutely work! But what happens if this data is somehow leaked or stolen by bad guys who want to hack the planet?!</p><p>Enter the cryptographic hash function that can scramble our data, a process referred to as hashing. Hashing involves taking in a string of data, running it through a mathematical algorithm, and outputting a slew of jumbled data that looks nothing like our original input. Our server will then store this hashed password and link it to the corresponding username. This hash function is referred to as a “one-way function” because it is infeasible to revert the process.</p><pre>hash(&quot;password&quot;) = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e7</pre><p>It is important to note though that with the same hashing algorithm (and there are a few out there), the hashed output of the same string will be the same. This is how the server verifies that we have indeed provided the correct password. Because it has stored the hashed password it can run the hash algorithm on our input and compared to two hashed results.</p><p>Great! Now if our the database of user/password information is leaked, we’re safe! Unfortunately we’ve only added one layer of security to our sensitive data. The problem lies with how predictable humans are. We tend to create passwords based on memorable keywords, phrases, or numbers such that the password is easier to remember. Hackers can use this to their advantage by creating a list of passwords derived from common terms and checking each password at high rates to find the right combination (dictionary attack). The hackers can take this a step further if they know the hashing algorithm used to produce the hashed passwords. They can take their dictionary and pre-hash all of the passwords creating a new “rainbow table” for their attacks. Now all they need to do is check to see if any of the hashes of the rainbow table match with any of the hashed passwords in the database and they have our password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*P-Y72HvKO8kyGVwVwk0V3g.png" /><figcaption>Push It!</figcaption></figure><p>This is where salting comes into play. As mentioned earlier a salt is extra and unique data that is usually generated randomly and added to our password. The concatenated result is then hashed and stored. However, because the salt is unique the produced hash of the same password will not be the same.</p><pre>hash(salt . &quot;hello&quot;) = 58756879c05c68dfac9866712fad6a93f8146f337a78t<br>hash(salt . &quot;hello&quot;) = c0e81794384491161f1777c232bc6bd9ec38f616560b1</pre><p>Now seasoning your password with salt is a highly effective way to combat the rainbow table attack as the hackers will now have to spend an enormous amount of resources (mostly time in computing) to produced hashed results on a large scale. So what about pepper? Pepper works in a similar way to salt in that it is data that is also appended to data prior to being hashed. However, the main difference is that while salt is stored with the hashed value, the pepper value is hidden away from the hashed value. This adds the additional benefit that the pepper is not known to the attacker.</p><p>Although pepper may seem like just more security, it is not as commonly utilized as a salt. Accepted hashing algorithms such as PBKDF2 and bcrypt were designed to derive keys with salts only. Until algorithms are designed for use with peppers (and accepted by cryptographers) they avoid the peppers altogether. Furthermore the maintainability of peppers (as these hidden values must be stored somewhere) is called into question. Because hashes are a one-way function, the rotation of the pepper key creates an additional problem. A password hashed with a pepper relies on that original pepper in order to be validated. This precludes the rotation of the pepper key, a big security flaw! For now salt-seasoned hash is the way to go.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b48328caa2af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TCP/IP: The Protocol Bros and Family]]></title>
            <link>https://medium.com/@berto168/tcp-ip-the-protocol-bros-and-family-3c142e42416a?source=rss-84a32eaca4c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c142e42416a</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[internet]]></category>
            <dc:creator><![CDATA[Robert Lin]]></dc:creator>
            <pubDate>Thu, 20 Oct 2016 05:37:12 GMT</pubDate>
            <atom:updated>2016-10-20T13:26:56.347Z</atom:updated>
            <content:encoded><![CDATA[<p>TCP/IP is so ubiquitous it’s probably how you are reading this blog right now! But first, what do they even stand for? And why do we care?</p><p>IP stands for <strong><em>Internet Protocol</em></strong> and it handles the how and where packets of information are sent. Picture a map of all the interconnectivity of all the computers (like the one below of the internet). Each road or connection creates a web to separate homes or addresses that the IP is in charge or routing to. This can be referred to as the Internet Layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4LUx6S0kYSvIkQv_bRlJw.png" /></figure><p>TCP, Transmission Control Protocol, is built on top of IP and has its own set of host-to-host responsibilities. TCP is responsible for ensuring the reliable transmission of data packets across the networks. This can be referred to as the Transport Layer. Together TCP and IP form the Internet Protocol Suite, a set of internet communication protocols to transmit and receive data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*-5eumikvJ-QeNpAgahjIjw.png" /></figure><ul><li>What kind of packet it is (protocol version number)</li><li>How big the header of the packet is (packet header length)</li><li>How to handle this packet (type of service telling the network whether to use the following options: minimize delay, maximize throughput, maximize reliability, and minimize cost)</li><li>How big the packet is (overall length of packet; as this is a 16-bit field, the maximum size of an IP packet is 65,535 bytes, but in practice most packets are around 1,500 bytes)</li><li>A unique identifier so this packet can be distinguished from other packets</li><li>Whether this packet is part of a longer data stream and should be handled relative to other packets</li><li>A description of where this packet fits into the data stream relative to other packets (the fragment offset)</li><li>A checksum of the packet header (to minimize the potential for data corruption during transmission)</li><li>Where the packet is from (source IP address such as 104.16.121.127)</li><li>Where the packet is going (destination IP address such as 104.16.121.127)</li><li>Option flags governing security and handling restrictions, whether to record timestamps, whether to record the route this packet has taken, and whether to use strict or loose source routing</li><li>The information this packet carries</li><li><em>Source: www.informit.com</em></li></ul><p>TCP/IP form the basis for communication through the internet. They utilize TCP/IP addresses such as 63.117.14.245. However, these addresses are not typically easy to remember so a domain name is used instead, in this case, <a href="http://www.medium.com./">www.google.com.</a></p><p>Many other application protocols are further built on top of TCP/IP with their own communication protocols and methods, such as the very well known HTTP (Hypertext Transfer Protocol — used for the common website as we know it) and SMTP (Simple Mail Transfer Protocol — email transmission) to FTP (File Transfer Protocol — as the name suggests, file transfers from server to client), SSH (Secure Shell — a crypto protocol providing a secure connection through key authentication), and even BitTorrent (P2P — peer-to-peer file sharing) or BitCoin (cryptocurrency providing P2P transactions).</p><p>The layers of abstraction can be traced down to the physical cables providing a network of connections between computers. In the end, communication through the internet is really just sending binary data (in 1’s and 0’s) through wires to communicate, though in large quantities of data, at the speed of light, and in a way that able to be understood by humans.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c142e42416a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ruby Bound & ERB]]></title>
            <link>https://medium.com/@berto168/ruby-bound-402e51083e79?source=rss-84a32eaca4c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/402e51083e79</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Robert Lin]]></dc:creator>
            <pubDate>Thu, 13 Oct 2016 06:30:47 GMT</pubDate>
            <atom:updated>2016-10-20T00:42:16.242Z</atom:updated>
            <content:encoded><![CDATA[<p>What is “binding” in Ruby? Up until now we have really only seen binding used in debugging code with the ‘pry’ gem and ‘binding.pry’. It allowed to to essentially freeze our interpreter in a certain state of the code, letting us check what the state our variables are in that given moment.</p><p>But is there more to binding? Well there must be because we have actually been calling the #pry method <em>on</em> a binding object this whole time!</p><p>Binding is a class whose instances (binding objects)…</p><blockquote>“encapsulate the execution context at some particular place in the code and retain this context for future use” — Ruby-doc (Class: Binding)</blockquote><p>What this means is a binding object captures and stores the <strong><em>local scope</em></strong> where it was called into itself. We can later pass these binding objects as an argument for the #eval method (evaluation) to peek into the the scope at the time of block execution.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8125291ede90bb2ad684f232ac3ac804/href">https://medium.com/media/8125291ede90bb2ad684f232ac3ac804/href</a></iframe><p>In the above example, we have defined a method #foo to set a local variable, x, equal to 1. We then placed a binding object within the method. Upon calling the method (line 6), we stored the binding object into a local variable “binding”. At this point, even though we have called #foo, the variable “x” is undefined in the main scope. However, with the use of #eval, we can pass the variable and the binding object to determine what the value of “x” is <strong><em>inside</em></strong> the method scope. In a sense, the binding <strong>captured the moment</strong> after #foo was called and ‘x’ was defined, but before the method had ended.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/709bfb331ff8aa13b76aef3f4b49a2e3/href">https://medium.com/media/709bfb331ff8aa13b76aef3f4b49a2e3/href</a></iframe><p>Another short example shows how we are able to use binding objects in Classes. How is it that we are able to read an instance variable of a Class without an attr_accessor? Well the binding object once again has stored the scope within allowing us to evaluate inside that scope of the instance.</p><p>To be fair, these are very simple examples and outside of debugging with ‘binding.pry’, the usage of a binding object seems obscure at best. How is binding significant to us? Well in week 3 of Flatiron School, we have just started learning about ERB (short for Embedded RuBy) and its usefulness in creating an HTML file with Ruby code embedded in it. Ruby on Rails will evaluate the Ruby code, allowing us to dynamically add content to the HTML file before it gets rendered. This process is referred to as ERB templating.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9cb7605c3bc77501664e18a335045eb3/href">https://medium.com/media/9cb7605c3bc77501664e18a335045eb3/href</a></iframe><p>In an ERB templating process we pass our ‘.html.erb’ file to create a new ERB template object such that we may render the template <em>in a scope where our code is run</em> (with binding!) and store the result to be sent as a response. The binding passed with the #result method on an ERB template <strong><em>references the state in time</em></strong> (scope) when the code is run, producing a rendered ERB.</p><p>If we look back at our ‘.pry’ method, it makes sense why it would utilize a Binding object. When ‘binding.pry’ freezes a block execution it allows us access inside the scope of the block, the same scope that is captured by that very instance of Binding. The Binding Class in Ruby is truly a unique and useful tool worth exploring in the Ruby toolbox!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=402e51083e79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Encapsulation & Private Methods]]></title>
            <link>https://medium.com/@berto168/encapsulation-private-methods-eac1cd62de5c?source=rss-84a32eaca4c8------2</link>
            <guid isPermaLink="false">https://medium.com/p/eac1cd62de5c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[object-oriented]]></category>
            <dc:creator><![CDATA[Robert Lin]]></dc:creator>
            <pubDate>Thu, 06 Oct 2016 00:28:32 GMT</pubDate>
            <atom:updated>2016-10-06T00:28:32.614Z</atom:updated>
            <content:encoded><![CDATA[<p>The concept of Object-oriented programming (OOP) is intriguing and allows us to model a program around objects and their interactions rather than solely through data and logic.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd6c0aa04feb0f88689114638928b1c1/href">https://medium.com/media/fd6c0aa04feb0f88689114638928b1c1/href</a></iframe><p>Encapsulation is a pattern for capturing an object’s intention and only exposing the components needed to interact with it. The above code allows the outside to call #walk on the Person object. Through the #walk method, the object will move its legs. However, we cannot tell the Person to move its legs. It knows how to walk by itself; the logic is there.</p><p>From outside the class, I should only know that I can tell the object to walk and not how to walk (unless we wanted to control a person like that). We don’t want the outside to be able to modify how person moves their legs as that may have detrimental effects on our Person object and can have us worrying needlessly about it.</p><p>Another example would be a clock. The clock can <strong>show me the current time</strong> and can <strong>have its time set</strong> (public methods). The logic of how the clock actually works is encapsulated inside the clock object. The complexity of the gears and motors is better left hidden to the outside user.</p><p>Think of encapsulation as a black box that you don’t want users to look into, because they shouldn’t care <em>how</em> something is done so long as the result produced is what they want.</p><p>Private Methods! — Example: Vending Machine</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/422445924d4b0726e70752bd188fa46d/href">https://medium.com/media/422445924d4b0726e70752bd188fa46d/href</a></iframe><p>Encapsulation is important to us as it separates details of a class that are irrelevant from the functions that matter. It effectively creates a barrier around an object such that code is contained. If something is poorly encapsulated, we have to worry about how a change in code might affect our system as a whole. An encapsulated method cannot be accessed outside of the object; the only way to modify it is through the object itself.</p><p>This increases the abstraction of an object by simplifying the complexities and focusing on what an object does in comparison to real life. When we look at a vending machine we can expect that we can feed it money, punch some buttons and get our food. We can then proceed to tackle a problem without thinking too much about the inside logic or the <em>how</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eac1cd62de5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>