<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: San</title>
    <description>The latest articles on Forem by San (@guardianangel).</description>
    <link>https://forem.com/guardianangel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F478467%2F2d333ade-e964-4925-a3b0-cdfe1c7b8f36.jpg</url>
      <title>Forem: San</title>
      <link>https://forem.com/guardianangel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/guardianangel"/>
    <language>en</language>
    <item>
      <title>What is Git, and Why Should You Use It?</title>
      <dc:creator>San</dc:creator>
      <pubDate>Mon, 01 May 2023 15:34:42 +0000</pubDate>
      <link>https://forem.com/guardianangel/what-is-git-and-why-should-you-use-it-370h</link>
      <guid>https://forem.com/guardianangel/what-is-git-and-why-should-you-use-it-370h</guid>
      <description>&lt;p&gt;Git is a version control system that allows you to track changes in your software development projects. It's a powerful tool that enables collaboration, makes it easy to revert to previous versions of your code, and facilitates teamwork on different branches of your codebase without interfering with each other's work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Benefits of Version Control with Git
&lt;/h2&gt;

&lt;p&gt;One of the most significant advantages of Git is that it supports branching. Branching is the creation of different versions of your codebase. Each branch is a separate copy of your codebase, and changes made in one branch do not affect the others until they are merged back into the main branch.&lt;/p&gt;

&lt;p&gt;Git is widely used by developers worldwide, and it's easy to install on Windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Install Git on Windows in 15 Easy Steps
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Visit the Git website and download the latest version of Git for Windows.&lt;/li&gt;
&lt;li&gt;Once the download is complete, open the installer by double-clicking on the downloaded file.&lt;/li&gt;
&lt;li&gt;In the Git Setup wizard, select the components you want to install. By default, all components are selected, so you can leave them as is.&lt;/li&gt;
&lt;li&gt;Choose the installation directory. The default location is usually fine, but you can change it if you want.&lt;/li&gt;
&lt;li&gt;Select the default editor that Git should use. You can choose between Nano, Vim, Emacs, and Notepad++.&lt;/li&gt;
&lt;li&gt;Choose the terminal emulator that Git should use. The default option is "Use Git Bash only," which is recommended.&lt;/li&gt;
&lt;li&gt;Select the default behavior for line endings. The default option is "Checkout as-is, commit as-is," which is usually fine.&lt;/li&gt;
&lt;li&gt;Choose the default behavior for handling symbolic links. The default option is "Checkout as-is, commit as symbolic links," which is also usually fine.&lt;/li&gt;
&lt;li&gt;Select whether you want Git to be available to all users or just the current user. The default option is "Use Git from Git Bash only," which is recommended.&lt;/li&gt;
&lt;li&gt;Choose the default behavior for the PATH environment variable. The default option is "Use Git from the Windows Command Prompt," which is recommended.&lt;/li&gt;
&lt;li&gt;Choose the HTTPS transport backend. The default option is "Use the OpenSSL library," which is recommended.&lt;/li&gt;
&lt;li&gt;Click "Install" to begin the installation process.&lt;/li&gt;
&lt;li&gt;Wait for the installation to complete. This may take a few minutes.&lt;/li&gt;
&lt;li&gt;Once the installation is complete, click "Finish" to exit the installer.&lt;/li&gt;
&lt;li&gt;Open a command prompt or Git Bash terminal and type "git --version" to verify that Git was installed correctly. If everything worked, you should see the Git version number displayed in the terminal.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Getting Started with Git: Creating a Repository and Making Commits
&lt;/h2&gt;

&lt;p&gt;Once you've installed Git on Windows, it's time to get started with version control. The first step is to create a repository, which is a directory that contains all the files and folders that make up your project.&lt;/p&gt;

&lt;p&gt;To create a repository, open a command prompt or Git Bash terminal and navigate to the directory where you want to create the repository. Then, type the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new Git repository in the current directory. You can now add files to the repository by typing the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add &amp;lt;filename&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will stage the file for the next commit. To make a commit, type the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "Your commit message here"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new commit with the changes you made to the file. You can view your commit history by typing the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Branching and Merging with Git: A Beginner's Guide
&lt;/h2&gt;

&lt;p&gt;As mentioned earlier, branching is one of the most significant benefits of using Git. Branches allow you to work on different parts of your codebase without interfering with each other's work. For example, if you're working on a new feature, you can create a separate branch for it, work on the feature, and then merge it back into the main branch when it's ready.&lt;/p&gt;

&lt;p&gt;To create a new branch, type the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch &amp;lt;branchname&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new branch with the specified name. You can switch to the new branch by typing the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout &amp;lt;branchname&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can make changes to the codebase in the new branch without affecting the main branch. When you're ready to merge the changes back into the main branch, switch back to the main branch and type the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge &amp;lt;branchname&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will merge the changes from the specified branch into the main branch. If there are any conflicts between the two branches, Git will prompt you to resolve them manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  Collaborating with Git: Pushing and Pulling Changes to a Remote Repository
&lt;/h2&gt;

&lt;p&gt;Git also enables collaboration between developers by allowing them to push and pull changes to a remote repository. A remote repository is a copy of your codebase stored on a remote server, such as GitHub or Bitbucket.&lt;/p&gt;

&lt;p&gt;To push your changes to a remote repository, you first need to add the remote repository as a Git remote. This is done using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add &amp;lt;name&amp;gt; &amp;lt;remoteurl&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here,  is a nickname for the remote repository, and  is the URL of the remote repository.&lt;/p&gt;

&lt;p&gt;Once you've added the remote repository, you can push your changes to it using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push &amp;lt;name&amp;gt; &amp;lt;branchname&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will push the changes in the specified branch to the remote repository.&lt;/p&gt;

&lt;p&gt;To pull changes from a remote repository, you can use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git pull &amp;lt;name&amp;gt; &amp;lt;branchname&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will pull the changes from the specified branch of the remote repository and merge them into your local branch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git Tips and Tricks: Customizing Your Workflow and Resolving Conflicts
&lt;/h2&gt;

&lt;p&gt;Git is a versatile tool with many customization options. Here are a few tips and tricks to help you get the most out of Git:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Git aliases to create shortcuts for commonly used Git commands.&lt;/li&gt;
&lt;li&gt;Use Git hooks to automate tasks, such as running tests or formatting code.&lt;/li&gt;
&lt;li&gt;Use Git stash to save changes temporarily without committing them.&lt;/li&gt;
&lt;li&gt;Use Git bisect to track down bugs by systematically testing different versions of your codebase.&lt;/li&gt;
&lt;li&gt;Use Git rebase to combine multiple commits into a single commit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Git can also help you resolve conflicts when two or more branches have made conflicting changes to the same codebase. When this happens, Git will prompt you to manually resolve the conflict by editing the affected files and choosing which changes to keep.&lt;/p&gt;

&lt;h2&gt;
  
  
  Git Resources: Where to Learn More and Get Help
&lt;/h2&gt;

&lt;p&gt;If you're new to Git, there are many resources available to help you learn more about it. Here are a few places to start:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The official Git documentation: &lt;a href="https://git-scm.com/doc"&gt;https://git-scm.com/doc&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The Git tutorial on Atlassian's website: &lt;a href="https://www.atlassian.com/git/tutorials"&gt;https://www.atlassian.com/git/tutorials&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;The Pro Git book by Scott Chacon and Ben Straub: &lt;a href="https://git-scm.com/book/en/v2"&gt;https://git-scm.com/book/en/v2&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion: Why Git is Essential for Developers
&lt;/h2&gt;

&lt;p&gt;In conclusion, Git is an essential tool for developers that offers many benefits, including version control, branching and merging, collaboration, and customization options. Whether you're working on a personal project or collaborating with a team, Git can help you keep track of changes to your codebase and ensure that everyone is working on the same version of the code.&lt;/p&gt;

&lt;p&gt;Installing Git on Windows is a straightforward process that involves downloading and installing Git for Windows from the official website. Once you've installed Git, you can start using it to manage your codebase and collaborate with others.&lt;/p&gt;

&lt;p&gt;If you're new to Git, it may take some time to learn all of its features and how to use them effectively. However, with practice and the help of online resources, you can become proficient in Git and use it to streamline your development workflow and improve your productivity. With Git, you can take your coding skills to the next level and become a more efficient and effective developer!&lt;/p&gt;

</description>
      <category>github</category>
      <category>beginners</category>
      <category>programming</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Exploratory Data Analysis Case Study - Companies Registered in India [1857 - 2020]</title>
      <dc:creator>San</dc:creator>
      <pubDate>Tue, 11 Apr 2023 16:28:29 +0000</pubDate>
      <link>https://forem.com/guardianangel/exploratory-data-analysis-case-study-companies-registered-in-india-1857-2020-1i48</link>
      <guid>https://forem.com/guardianangel/exploratory-data-analysis-case-study-companies-registered-in-india-1857-2020-1i48</guid>
      <description>&lt;p&gt;Exploratory Data Analysis (EDA) is a critical step in any data science project, and it involves analyzing datasets to summarize their main characteristics and uncover patterns, relationships, and anomalies. In this blog post, we'll take a closer look at one such dataset titled &lt;a href="https://www.kaggle.com/datasets/rowhitswami/all-indian-companies-registration-data-1900-2019"&gt;"Registered Companies" on Kaggle&lt;/a&gt;, and perform EDA on it to understand its main features.&lt;/p&gt;

&lt;p&gt;The dataset contains information about registered companies in India, and includes 15 columns with various details such as the company name, registration date, industry classification, authorized capital, paid-up capital, and more. The dataset has over 15,000 records, making it a rich source of information for analyzing trends in the Indian corporate sector.&lt;/p&gt;

&lt;p&gt;Let's begin by importing the necessary libraries and loading the dataset into a pandas DataFrame:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

companies_df = pd.read_csv('https://cdn.jovian.ml/sanuann/registered_companies.csv')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, let's take a look at the first few rows of the DataFrame to get an idea of the data structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;companies_df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output should resemble the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             CIN                      COMPANY_NAME  ...    PAIDUP_CAPITAL      ACTIVITY_CODE
0  U93090TN2008PTC069316     BLUE LOTUS TECHNOLOGIES  ...           1500000  93090
1  U14292DL2005PTC136633  INDO ASIAN FUSEGEAR LIMITED  ...          68872420  14292
2  U51103MH2007PTC170327      JAIHIND PROJECTS PR LTD  ...          37830000  51103
3  U45203KA2007PTC042123      SILVERLINE INDIA PR LTD  ...           1600000  45203
4  U51109WB2005PTC106210        RUPASHI BANGLES PR LTD  ...            100000  51109
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can see that the dataset contains the company identification number (CIN), company name, registration date, state, industry classification, authorized capital, paid-up capital, and other details.&lt;/p&gt;

&lt;p&gt;Let's now explore the dataset by analyzing the distribution of various features using histograms, box plots, and scatter plots. We'll start by analyzing the distribution of the authorized and paid-up capital:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sns.histplot(companies_df['AUTHORIZED_CAPITAL'])
plt.title('Distribution of Authorized Capital')
plt.xlabel('Authorized Capital (in crores)')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output should resemble the following:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;We can see that the majority of companies have an authorized capital of less than 10 crore, with a few companies having authorized capital greater than 100 crore.&lt;/p&gt;

&lt;p&gt;Let's now analyze the relationship between authorized and paid-up capital using a scatter plot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sns.scatterplot(x='AUTHORIZED_CAPITAL', y='PAIDUP_CAPITAL', data=companies_df)
plt.title('Relationship between Authorized Capital and Paid-up Capital')
plt.xlabel('Authorized Capital (in crores)')
plt.ylabel('Paid-up Capital (in crores)')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output should resemble the following:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;We can see that there is a strong positive correlation between authorized and paid-up capital, indicating that companies with higher authorized capital tend to have higher paid-up capital as well.&lt;/p&gt;

&lt;p&gt;Let's now analyze the distribution of the industry classification using a box plot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sns.boxplot(y='PRINCIPAL_BUSINESS_ACTIVITY_AS_PER_CIN', x='PAIDUP_CAPITAL', data=companies_df)
plt.title('Distribution of Industry Classification by Paid-up Capital')
plt.xlabel('Paid-up Capital (in crores)')
plt.ylabel('Industry Classification')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output should resemble the following:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;We can see that the distribution of industry classification varies widely across different paid-up capital levels, with certain industries such as finance and real estate having higher paid-up capital on average.&lt;/p&gt;

&lt;p&gt;In conclusion, we've performed EDA on the "Registered Companies" dataset, and analyzed the distribution of various features using histograms, scatterplots, and box plots. We've identified interesting trends such as the strong correlation between authorized and paid-up capital, and the variation in industry classification across different paid-up capital levels. The dataset provides valuable insights into the Indian corporate sector, and can be used for further analysis and modeling.&lt;br&gt;
For more information on this analysis or to run the project see here: &lt;a href="https://jovian.com/sanuann/eda-registered-companies"&gt;https://jovian.com/sanuann/eda-registered-companies&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you found this blog post informative and helpful. If you have any questions or feedback, please feel free to leave a comment below.&lt;/p&gt;

</description>
      <category>eventdriven</category>
      <category>dataanalysis</category>
      <category>pandas</category>
      <category>python</category>
    </item>
    <item>
      <title>How to encrypt a text using Python (key and text) and decrypt that cipher in JavaScript using the same key.</title>
      <dc:creator>San</dc:creator>
      <pubDate>Tue, 11 Apr 2023 13:38:41 +0000</pubDate>
      <link>https://forem.com/guardianangel/how-to-encrypt-a-text-using-python-key-and-text-and-decrypt-that-cipher-in-javascript-using-the-same-key-5dbm</link>
      <guid>https://forem.com/guardianangel/how-to-encrypt-a-text-using-python-key-and-text-and-decrypt-that-cipher-in-javascript-using-the-same-key-5dbm</guid>
      <description>&lt;p&gt;Here's an example of how to encrypt a text using Python and decrypt it using JavaScript using the same key.&lt;/p&gt;

&lt;p&gt;First, let's write the encryption function in Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import base64
from Crypto.Cipher import AES

def encrypt(key, text):
    cipher = AES.new(key.encode(), AES.MODE_ECB)
    text = text.encode()
    while len(text) % 16 != 0:
        text += b' '
    encrypted_text = cipher.encrypt(text)
    return base64.b64encode(encrypted_text).decode()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function uses the PyCryptodome library to perform AES encryption in ECB mode. It takes in a key and a text to encrypt, and returns the encrypted text in base64-encoded format.&lt;/p&gt;

&lt;p&gt;Now, let's write the decryption function in JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function decrypt(key, encrypted_text) {
    var decipher = crypto.createDecipheriv('aes-256-ecb', key, '');
    var decrypted_text = decipher.update(encrypted_text, 'base64', 'utf8');
    decrypted_text += decipher.final('utf8');
    return decrypted_text;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function uses the built-in crypto module in Node.js to perform AES decryption in ECB mode. It takes in a key and the encrypted text (in base64-encoded format), and returns the decrypted text.&lt;/p&gt;

&lt;p&gt;Note that we need to use the same key and mode of operation (ECB) in both the Python and JavaScript functions.&lt;/p&gt;

&lt;p&gt;Here's an example usage:&lt;br&gt;
In python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;key = 'mysecretkey'
text = 'Hello, world!'
encrypted_text = encrypt(key, text)
print(encrypted_text)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In javascript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var key = 'mysecretkey';
var encrypted_text = 'ryd7yQJ4h8gkSYJxKxHqKA==';
var decrypted_text = decrypt(key, encrypted_text);
console.log(decrypted_text);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should output Hello, world! in both Python and JavaScript.&lt;/p&gt;

&lt;p&gt;Note that ECB mode is generally not considered secure for encryption, as it can leak information about the plaintext. It's better to use a more secure mode like CBC or GCM.&lt;/p&gt;

&lt;p&gt;Let us now try the same problem using one of the more secure ways. Here's an example using AES in CBC mode with PKCS7 padding in Python and Node.js:&lt;/p&gt;

&lt;p&gt;Python Encryption:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad

def encrypt(key, text):
    iv = b'\x00' * 16 # initialization vector, must be random for real-world use
    cipher = AES.new(key.encode(), AES.MODE_CBC, iv)
    text = text.encode()
    padded_text = pad(text, AES.block_size, style='pkcs7')
    encrypted_text = cipher.encrypt(padded_text)
    return base64.b64encode(iv + encrypted_text).decode()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JavaScript decryption:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const crypto = require('crypto');

function decrypt(key, encrypted_text) {
    const encrypted_bytes = Buffer.from(encrypted_text, 'base64');
    const iv = encrypted_bytes.slice(0, 16);
    const ciphertext = encrypted_bytes.slice(16);
    const decipher = crypto.createDecipheriv('aes-256-cbc', key, iv);
    decipher.setAutoPadding(false); // disable automatic padding
    const decrypted_text = decipher.update(ciphertext);
    const unpadded_text = Buffer.concat([decrypted_text, decipher.final()]);
    return unpadded_text.toString('utf8');
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we use AES in CBC mode with a random initialization vector (IV) for each encryption. We also use PKCS7 padding, which is a commonly used padding scheme that ensures that the plaintext is a multiple of the block size before encryption. In addition, we disable automatic padding in the JavaScript decryption function, since we need to handle padding manually.&lt;/p&gt;

&lt;p&gt;Here's an example usage:&lt;br&gt;
python version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;key = 'mysecretkey'
text = 'Hello, world!'
encrypted_text = encrypt(key, text)
print(encrypted_text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JavaScript version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const key = 'mysecretkey';
const encrypted_text = 'WwOzn2/Cyaa1/Hpnv2PrMhB6g0m6o9PbyiG4z4HiW0w=';
const decrypted_text = decrypt(key, encrypted_text);
console.log(decrypted_text);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should output Hello, world! in both Python and JavaScript.&lt;/p&gt;

&lt;p&gt;Note that the key should always be kept secret and should be shared securely between the encrypting and decrypting parties. In addition, the IV should be random for each encryption to ensure security.&lt;/p&gt;

&lt;p&gt;In this article, we demonstrated how to encrypt a text using Python with AES encryption in CBC mode and PKCS7 padding, and how to decrypt the encrypted text using JavaScript with the same key. The Python function used the PyCryptodome library for AES encryption, while the JavaScript function used the built-in crypto module in Node.js.&lt;/p&gt;

&lt;p&gt;We also discussed the importance of using a secure encryption mode like CBC and using a random initialization vector (IV) for each encryption to ensure security. Finally, we highlighted that the key should always be kept secret and shared securely between the encrypting and decrypting parties.&lt;/p&gt;

</description>
      <category>encrypt</category>
      <category>python</category>
      <category>javascript</category>
      <category>decrypt</category>
    </item>
  </channel>
</rss>
