<?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 Pravallika Yakkala on Medium]]></title>
        <description><![CDATA[Stories by Pravallika Yakkala on Medium]]></description>
        <link>https://medium.com/@pravallikayakkala123?source=rss-5b3361a2d799------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*0wi9BqB9S7wOB74g.jpg</url>
            <title>Stories by Pravallika Yakkala on Medium</title>
            <link>https://medium.com/@pravallikayakkala123?source=rss-5b3361a2d799------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 04:20:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pravallikayakkala123/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[The Evolution of Java: From Its Roots to Modern Advancements]]></title>
            <link>https://medium.com/@pravallikayakkala123/the-evolution-of-java-from-its-roots-to-modern-advancements-9d86d9234bb4?source=rss-5b3361a2d799------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d86d9234bb4</guid>
            <dc:creator><![CDATA[Pravallika Yakkala]]></dc:creator>
            <pubDate>Tue, 24 Sep 2024 15:51:13 GMT</pubDate>
            <atom:updated>2024-09-24T15:51:13.319Z</atom:updated>
            <content:encoded><![CDATA[<p>Java, a programming language that has stood the test of time, is now well over 28 years old. Its journey through the decades showcases a remarkable evolution, reflecting the shifting paradigms of software development. Although Java has been perceived as moving slowly — especially before the landmark Java 8 release — its gradual adaptation has paved the way for significant advancements.</p><h3>Java Before Version 8: The Old School Approach</h3><p>Prior to Java 8, the language primarily relied on imperative coding and the traditional object-oriented programming (OOP) model. While this approach laid the foundation for many applications, it often felt cumbersome, limiting the potential for more expressive and concise coding styles. The performance and capabilities of Java were perceived as insufficient, particularly in comparison to emerging programming languages that embraced functional programming paradigms.</p><h3>Example of Imperative Style Before Java 8</h3><p>Consider a simple example of filtering a list of numbers to find even numbers. In Java 7 and earlier, you might do this using a traditional for-loop:</p><pre>import java.util.ArrayList;<br>import java.util.List;<br><br>public class EvenNumbers {<br>    public static void main(String[] args) {<br>        List&lt;Integer&gt; numbers = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);<br>        List&lt;Integer&gt; evenNumbers = new ArrayList&lt;&gt;();<br>        <br>        for (Integer number : numbers) {<br>            if (number % 2 == 0) {<br>                evenNumbers.add(number);<br>            }<br>        }<br><br>        System.out.println(&quot;Even Numbers: &quot; + evenNumbers);<br>    }<br>}</pre><p>In this example, the imperative style requires managing state and using loops, which can become verbose and difficult to read.</p><h3>Java 8: A Game Changer:</h3><p>The release of Java 8 marked a turning point in the language’s trajectory. With the introduction of functional programming features, Java transitioned from purely imperative and OOP paradigms to a more flexible framework that included functional programming capabilities. Key additions like lambda expressions, the Stream API, and default methods revolutionized how developers approached problem-solving in Java.</p><h3>Example of Functional Style in Java 8</h3><p>The same example of filtering even numbers can now be accomplished in a more concise and expressive way using the Stream API:</p><pre>import java.util.List;<br>import java.util.stream.Collectors;<br><br>public class EvenNumbers {<br>    public static void main(String[] args) {<br>        List&lt;Integer&gt; numbers = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);<br>        <br>        List&lt;Integer&gt; evenNumbers = numbers.stream()<br>            .filter(number -&gt; number % 2 == 0)<br>            .collect(Collectors.toList());<br><br>        System.out.println(&quot;Even Numbers: &quot; + evenNumbers);<br>    }<br>}</pre><p>This version is cleaner and focuses on what you want to achieve rather than how to achieve it.</p><h3>Java 10: Local Variable Type Inference</h3><p>Java 10 continued this trajectory by introducing local variable type inference with the var keyword. This allows the compiler to infer the type of the variable, reducing verbosity.</p><h3>Example of Local Variable Type Inference</h3><h3>Before Java 10</h3><pre>import java.util.List;<br><br>public class LocalVariableTypeInference {<br>    public static void main(String[] args) {<br>        List&lt;String&gt; names = List.of(&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;);<br>        <br>        for (List&lt;String&gt; list : names) {<br>            System.out.println(list);<br>        }<br>    }<br>}</pre><h3>After Java 10</h3><pre>import java.util.List;<br><br>public class LocalVariableTypeInference {<br>    public static void main(String[] args) {<br>        var names = List.of(&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;);<br>        <br>        for (var name : names) {<br>            System.out.println(name);<br>        }<br>    }<br>}</pre><p>The var keyword makes the code cleaner and easier to read.</p><h3>Java 11 and Beyond: New Features and Enhancements</h3><p>Java 11 introduced several impactful features, further enhancing its functionality and usability:</p><h3>Switch Expressions</h3><p>Switch expressions allow developers to replace cumbersome if-else chains with cleaner, more concise syntax.</p><h4>Example of Traditional Switch Statement (Before Java 11)</h4><pre>public static String grade(int score) {<br>    String grade = &quot;F&quot;;<br>    switch (score / 10) {<br>        case 10:<br>            grade = &quot;A&quot;;<br>            break;<br>        case 9:<br>            grade = &quot;B&quot;;<br>            break;<br>        default:<br>            grade = &quot;F&quot;;<br>    }<br>    return grade;<br>}</pre><h4>Example of Switch Expressions (After Java 11)</h4><p>With Java 11, the switch statement can be expressed as follows:</p><pre>public static String grade(int score) {<br>    return switch (Math.min(score / 10, 10)) {<br>        case 10 -&gt; &quot;A&quot;;<br>        case 9 -&gt; &quot;B&quot;;<br>        default -&gt; &quot;F&quot;;<br>    };<br>}</pre><p>This approach not only shortens the code but also enhances readability.</p><h3>Smart Casting</h3><p>Java 11 also introduced smart casting, streamlining the type-checking process.</p><h4>Example of Traditional Type Checking (Before Java 11)</h4><pre>public static String process(Object input) {<br>    if (input instanceof Integer) {<br>        return &quot;got a number&quot;;<br>    }<br>    if (input instanceof String) {<br>        String str = (String) input;<br>        var length = str.length();<br>        return &quot;got a string of length: &quot; + length;<br>    }<br>    return &quot;unknown type&quot;;<br>}</pre><h4>Example of Smart Casting (After Java 11)</h4><pre>public static String process(Object input) {<br>    if (input instanceof Integer) {<br>        return &quot;got a number&quot;;<br>    }<br>    if (input instanceof String str) {<br>        var length = str.length();<br>        return &quot;got a string of length: &quot; + length;<br>    }<br>    return &quot;unknown type&quot;;<br>}</pre><p>Smart casting simplifies the code and enhances type safety.</p><h3>Additional Features</h3><p>Java 11 introduced several other features that enhanced productivity:</p><ul><li>Text Blocks: Allow for multi-line string literals, improving readability.</li></ul><pre>String json = &quot;&quot;&quot;<br>    {<br>        &quot;name&quot;: &quot;Alice&quot;,<br>        &quot;age&quot;: 30<br>    }<br>    &quot;&quot;&quot;;</pre><p>. Records: Simplify the creation of data-carrying classes.</p><pre>record Person(String name, int age) {}<br><br>Person person = new Person(&quot;Alice&quot;, 30);</pre><ul><li>Sealed Classes: Control which classes can extend or implement a class.</li><li>Pattern Matching: Further simplifies type checks.</li><li>Unnamed Variables: Allow variables to be declared without a name when the value is not needed.</li><li>Virtual Threads: Improve performance and scalability for concurrent programming.</li></ul><h3>A Pragmatic Future for Java</h3><p>The evolution of Java reflects a commitment to pragmatic growth and responsiveness to the needs of developers. By embracing modern programming paradigms and continuously adapting, Java remains a powerful tool in the software development landscape. As we look to the future, the language is poised to meet the demands of an ever-evolving technology landscape, ensuring its relevance for years to come.</p><p>In conclusion, Java’s journey from its early days to its current state showcases not only the evolution of a programming language but also the adaptability and foresight of its development community. With each release, Java strengthens its position as a foundational language in the world of software development.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d86d9234bb4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding AES Encryption and AES/GCM Mode: An In-Depth Exploration using Java]]></title>
            <link>https://medium.com/@pravallikayakkala123/understanding-aes-encryption-and-aes-gcm-mode-an-in-depth-exploration-using-java-e03be85a3faa?source=rss-5b3361a2d799------2</link>
            <guid isPermaLink="false">https://medium.com/p/e03be85a3faa</guid>
            <dc:creator><![CDATA[Pravallika Yakkala]]></dc:creator>
            <pubDate>Tue, 13 Aug 2024 16:17:45 GMT</pubDate>
            <atom:updated>2024-08-13T16:17:45.794Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction:</h3><p>Encryption is a critical component of modern security practices, enabling us to protect sensitive data from unauthorized access. Among the various encryption algorithms available, AES (Advanced Encryption Standard) stands out as one of the most widely used and trusted methods. This article explores AES encryption, the AES/GCM mode, and key concepts such as nonce, IV (Initialization Vector), and symmetric encryption. Additionally, we will compare AES with DES (Data Encryption Standard) to understand their differences and applications.</p><p><strong>What is AES Encryption?</strong></p><p>AES, or Advanced Encryption Standard, is a symmetric key encryption algorithm. It replaced the older DES (Data Encryption Standard) due to its superior security and efficiency. AES encrypts data using block ciphers with key sizes of 128, 192, or 256 bits. Its symmetric nature means that the same key is used for both encryption and decryption.</p><p><strong>AES/GCM Mode</strong></p><p>AES can be used in various modes of operation to enhance its functionality. One such mode is GCM (Galois/Counter Mode), which provides both encryption and authentication. AES/GCM is particularly notable for its performance and security features:</p><p><strong>GCM Mode</strong>: GCM combines AES with a Counter mode for encryption and Galois mode for authentication. This ensures both confidentiality and integrity of the data.</p><p><strong>Counter Mode</strong>: In AES/GCM, Counter mode (CTR) transforms the block cipher into a stream cipher by encrypting successive values of a counter. This method allows for parallel processing and efficient encryption/decryption operations.</p><p><strong>Galois Mode</strong>: Galois mode provides message authentication by generating a tag that verifies the authenticity of the data. This ensures that the data has not been tampered with.</p><p><strong>Key Concepts in AES/GCM</strong></p><p>To understand how AES/GCM works, it’s important to grasp several key concepts:</p><p><strong>Nonce/IV (Initialization Vector)</strong>: The nonce, also known as the IV, is a unique value used in combination with the encryption key. For AES/GCM, a nonce (typically 12 bytes) ensures that the same plaintext encrypted with the same key will produce different ciphertexts each time. This prevents replay attacks and enhances security.</p><p><strong>Key</strong>: The key is a secret value used in both encryption and decryption processes. In AES, key sizes can be 128, 192, or 256 bits. The strength of AES encryption largely depends on the key size — the larger the key, the more secure the encryption.</p><p><strong>Symmetric Encryption</strong>: Symmetric encryption uses the same key for both encryption and decryption. This contrasts with asymmetric encryption, which uses a pair of keys (public and private). Symmetric encryption is generally faster and more efficient, making it suitable for encrypting large volumes of data.</p><p><strong>Practical Example: AES/GCM Encryption and Decryption</strong></p><p>Consider the following Java code snippet that demonstrates AES/GCM encryption and decryption:</p><p>Here, in this example for decryption I assumed the encrypted text and iv are stored in base64 format</p><pre>import javax.crypto.Cipher;<br>import javax.crypto.KeyGenerator;<br>import javax.crypto.SecretKey;<br>import javax.crypto.spec.GCMParameterSpec;<br>import javax.crypto.spec.SecretKeySpec;<br>import java.nio.charset.StandardCharsets;<br>import java.security.SecureRandom;<br>import java.util.Base64;<br><br>public class Main {<br><br>    private static final int KEY_SIZE_256 = 256; // AES key size in bits<br>    private static final int IV_SIZE = 32;       // AES/GCM recommended nonce (IV) size in bytes<br>    private static final int TAG_LENGTH_BITS = 128; // Authentication tag length in bits for GCM mode<br><br>    public static void main(String[] args) {<br>        try {<br>            // Generate a new AES key<br>            SecretKey key = generateKey();<br>            // Generate a random nonce (IV) for encryption<br>            byte[] iv = generateNonce(IV_SIZE);<br><br>            // Original text to encrypt<br>            String originalText = &quot;pSZITP5i6t&quot;;<br><br>            // Encrypt the original text<br>            String encryptedText = encryptKey(originalText, key, iv);<br>            String keyBase64 = Base64.getEncoder().encodeToString(key.getEncoded());<br>            String ivBase64 = Base64.getEncoder().encodeToString(iv);<br><br>            System.out.println(&quot;Encrypted text: &quot; + encryptedText);<br>            System.out.println(&quot;Key (Base64): &quot; + keyBase64);<br>            System.out.println(&quot;IV (Base64): &quot; + ivBase64);<br><br>            // Decrypt the encrypted text using the generated key and IV<br>            String decryptedText = decryptKey(encryptedText, keyBase64, ivBase64);<br>            System.out.println(&quot;Decrypted text: &quot; + decryptedText);<br><br>        } catch (Exception e) {<br>            e.printStackTrace();<br>        }<br>    }<br><br>    /**<br>     * Generates a new AES key.<br>     *<br>     * @return The generated SecretKey object.<br>     * @throws Exception If key generation fails.<br>     */<br>    public static SecretKey generateKey() throws Exception {<br>        KeyGenerator keyGen = KeyGenerator.getInstance(&quot;AES&quot;);<br>        keyGen.init(KEY_SIZE_256); // Initialize key generator with 256-bit key size<br>        return keyGen.generateKey();<br>    }<br><br>    /**<br>     * Generates a random nonce (IV) for AES/GCM encryption.<br>     *<br>     * @param size The size of the nonce in bytes.<br>     * @return The generated nonce as a byte array.<br>     */<br>    public static byte[] generateNonce(int size) {<br>        byte[] nonce = new byte[size];<br>        new SecureRandom().nextBytes(nonce); // Fill nonce with random bytes<br>        return nonce;<br>    }<br><br>    /**<br>     * Encrypts a plaintext string using AES/GCM/NoPadding.<br>     *<br>     * @param input The plaintext string to encrypt.<br>     * @param key The AES SecretKey to use for encryption.<br>     * @param iv The initialization vector (nonce) for encryption.<br>     * @return The encrypted text encoded in Base64.<br>     * @throws Exception If encryption fails.<br>     */<br>    public static String encryptKey(String input, SecretKey key, byte[] iv) throws Exception {<br>        Cipher cipher = Cipher.getInstance(&quot;AES/GCM/NoPadding&quot;);<br>        GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH_BITS, iv);<br>        cipher.init(Cipher.ENCRYPT_MODE, key, gcmParameterSpec);<br><br>        byte[] inputBytes = input.getBytes(StandardCharsets.UTF_8);<br>        byte[] encryptedBytes = cipher.doFinal(inputBytes);<br>        return Base64.getEncoder().encodeToString(encryptedBytes);<br>    }<br><br>    /**<br>     * Decrypts a Base64 encoded encrypted text using AES/GCM/NoPadding.<br>     *<br>     * @param encryptedInput The Base64 encoded encrypted text to decrypt.<br>     * @param encodedKey The Base64 encoded AES SecretKey used for decryption.<br>     * @param encodedIV The Base64 encoded initialization vector (nonce) used for decryption.<br>     * @return The decrypted plaintext string.<br>     * @throws Exception If decryption fails.<br>     */<br>    public static String decryptKey(String encryptedInput, String encodedKey, String encodedIV) throws Exception {<br>        Cipher cipher = Cipher.getInstance(&quot;AES/GCM/NoPadding&quot;);<br>        <br>        // Decode Base64 encoded key and IV<br>        byte[] keyBytes = Base64.getDecoder().decode(encodedKey);<br>        byte[] iv = Base64.getDecoder().decode(encodedIV);<br>        <br>        GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(TAG_LENGTH_BITS, iv);<br>        SecretKey key = new SecretKeySpec(keyBytes, &quot;AES&quot;);<br>        cipher.init(Cipher.DECRYPT_MODE, key, gcmParameterSpec);<br><br>        // Decode Base64 encoded encrypted text<br>        byte[] encryptedBytes = Base64.getDecoder().decode(encryptedInput);<br>        byte[] decryptedBytes = cipher.doFinal(encryptedBytes);<br>        <br>        return new String(decryptedBytes, StandardCharsets.UTF_8);<br>    }<br>}</pre><p><strong>Comparing AES and DES:</strong></p><p>AES and DES are both symmetric encryption algorithms, but they differ significantly in terms of security and performance:</p><p><strong>DES (Data Encryption Standard)</strong>: DES was introduced in the 1970s and uses a 56-bit key. It was widely used for many years but is now considered insecure due to advances in computational power. The key size of DES is relatively small by modern standards, making it vulnerable to brute-force attacks.</p><p><strong>AES (Advanced Encryption Standard): </strong>AES, on the other hand, uses key sizes of 128, 192, or 256 bits, providing much stronger security. Its larger key sizes and more complex algorithm make it resistant to brute-force attacks and other forms of cryptographic analysis. AES is also more efficient than DES, thanks to its design and optimization for modern processors.</p><h3>Conclusion</h3><p>AES is a powerful and versatile encryption algorithm that ensures data security through its various modes of operation, with AES/GCM offering both encryption and authentication. Understanding the concepts of nonce, IV, and symmetric encryption is crucial for implementing secure cryptographic systems. Compared to DES, AES provides significantly stronger security and performance, making it the preferred choice in modern cryptographic applications. As cybersecurity threats evolve, adopting robust encryption standards like AES is essential for protecting sensitive information and maintaining data integrity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e03be85a3faa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>