<?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>DEV Community: Parth Agarwal</title>
    <description>The latest articles on DEV Community by Parth Agarwal (@ra101).</description>
    <link>https://dev.to/ra101</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%2F471869%2F8c348996-72a9-461b-95d4-3b599df6284f.jpg</url>
      <title>DEV Community: Parth Agarwal</title>
      <link>https://dev.to/ra101</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ra101"/>
    <language>en</language>
    <item>
      <title>Beyond SCP: Mastering VM File Transfers with Rsync and HTTPS Accelerators</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Wed, 14 Jan 2026 07:40:40 +0000</pubDate>
      <link>https://dev.to/ra101/-22ie</link>
      <guid>https://dev.to/ra101/-22ie</guid>
      <description>&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk" class="crayons-story__hidden-navigation-link"&gt;Beyond SCP: Mastering VM File Transfers with Rsync and HTTPS Accelerators&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/ra101" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F471869%2F8c348996-72a9-461b-95d4-3b599df6284f.jpg" alt="ra101 profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/ra101" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Parth Agarwal
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Parth Agarwal
                
              
              &lt;div id="story-author-preview-content-2885251" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/ra101" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F471869%2F8c348996-72a9-461b-95d4-3b599df6284f.jpg" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Parth Agarwal&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jan 14&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk" id="article-link-2885251"&gt;
          Beyond SCP: Mastering VM File Transfers with Rsync and HTTPS Accelerators
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/linux"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;linux&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/opensource"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;opensource&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/devops"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;devops&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/programming"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;programming&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;6&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            7 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;




</description>
      <category>linux</category>
      <category>opensource</category>
      <category>devops</category>
      <category>programming</category>
    </item>
    <item>
      <title>Beyond SCP: Mastering VM File Transfers with Rsync and HTTPS Accelerators</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Wed, 14 Jan 2026 07:37:27 +0000</pubDate>
      <link>https://dev.to/ra101/-1m13</link>
      <guid>https://dev.to/ra101/-1m13</guid>
      <description>&lt;p&gt;

&lt;/p&gt;
&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk" class="crayons-story__hidden-navigation-link"&gt;Beyond SCP: Mastering VM File Transfers with Rsync and HTTPS Accelerators&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;

          &lt;a href="/ra101" class="crayons-avatar  crayons-avatar--l  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F471869%2F8c348996-72a9-461b-95d4-3b599df6284f.jpg" alt="ra101 profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/ra101" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Parth Agarwal
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Parth Agarwal
                
              
              &lt;div id="story-author-preview-content-2885251" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/ra101" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F471869%2F8c348996-72a9-461b-95d4-3b599df6284f.jpg" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Parth Agarwal&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

          &lt;/div&gt;
          &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;Jan 14&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk" id="article-link-2885251"&gt;
          Beyond SCP: Mastering VM File Transfers with Rsync and HTTPS Accelerators
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/linux"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;linux&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/opensource"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;opensource&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/devops"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;devops&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/programming"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;programming&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;6&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              &lt;span class="hidden s:inline"&gt;Add Comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            7 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;




</description>
      <category>linux</category>
      <category>opensource</category>
      <category>devops</category>
      <category>programming</category>
    </item>
    <item>
      <title>Beyond SCP: Mastering VM File Transfers with Rsync and HTTPS Accelerators</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Wed, 14 Jan 2026 07:36:39 +0000</pubDate>
      <link>https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk</link>
      <guid>https://dev.to/ra101/beyond-scp-mastering-vm-file-transfers-with-rsync-and-https-accelerators-5hnk</guid>
      <description>&lt;p&gt;Transferring files between your local machine and a virtual machine (VM) is one of the most common tasks in tech. We often use &lt;code&gt;scp&lt;/code&gt; because it comes natively installed and has similar utilization to &lt;code&gt;ssh&lt;/code&gt;, but it is the clunkiest tool for the job.&lt;/p&gt;

&lt;p&gt;In this article, we’ll walk through the major CLI tools available, explain how they work under the hood, and highlight when you should use each.&lt;/p&gt;

&lt;p&gt;We’ll cover:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SSH (Secure Shell) Tools&lt;/strong&gt;&lt;br&gt;
1.1 SCP (Secure Copy)&lt;br&gt;
1.2 SFTP (SSH File Transfer Protocol)&lt;br&gt;
1.3 SSHFS (SSH Filesystem Mount)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rsync&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTTP(S) + Download Accelerators&lt;/strong&gt;&lt;br&gt;
3.1 HTTP Single-thread server (Python)&lt;br&gt;
3.2 HTTP Multi-thread server (BusyBox httpd)&lt;br&gt;
     3.2.1 &lt;em&gt;Download Accelerators (aria2c, axel)&lt;/em&gt;&lt;br&gt;
3.3 HTTPS File Server with Basic Auth (Caddy)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  1. SSH (Secure Shell) Tools
&lt;/h2&gt;

&lt;p&gt;These tools leverage the established Secure Shell (SSH) protocol for secure, encrypted transfers and operations.&lt;/p&gt;

&lt;h3&gt;
  
  
  1.1 SCP (Secure Copy)
&lt;/h3&gt;

&lt;p&gt;SCP is the classic method for transferring files over SSH. It opens a secure channel, encrypts data, and performs a raw byte stream transfer.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Encrypted&lt;/th&gt;
&lt;th&gt;Resumable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SSH&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Upload a file&lt;/span&gt;
scp local_file user@remote:/path/to/destination

&lt;span class="c"&gt;# Download a file&lt;/span&gt;
scp user@remote:/path/to/file local_dir/

&lt;span class="c"&gt;# Copy between two remote SSH hosts&lt;/span&gt;
scp user1@remote1:/file user2@remote2:/destination
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Installed by default on nearly all systems.&lt;/li&gt;
&lt;li&gt;Simple syntax for quick transfers.&lt;/li&gt;
&lt;li&gt;Can copy files directly between two remote SSH servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No resumability; interrupted transfers start from scratch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💙 Best Use Case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scp&lt;/code&gt; is best for one-off, quick, and secure transfers where you don’t expect interruptions.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  1.2 SFTP (SSH File Transfer Protocol)
&lt;/h3&gt;

&lt;p&gt;SFTP is more feature-rich than SCP. It supports interactive sessions, directory traversal, file operations, and &lt;strong&gt;resumable transfers&lt;/strong&gt; (when the client supports the feature).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Encrypted&lt;/th&gt;
&lt;th&gt;Resumable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SSH (subsystem)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Interactive session&lt;/span&gt;
sftp user@remote
sftp&amp;gt; get &lt;span class="nt"&gt;-a&lt;/span&gt; remote_file local_file  &lt;span class="c"&gt;# -a for resume/continue or use reget instead.&lt;/span&gt;
sftp&amp;gt; put local_file remote_file

&lt;span class="c"&gt;# One-liner download&lt;/span&gt;
sftp user@remote:/path/to/file local_file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resumable transfers with most clients (using -a or reget).&lt;/li&gt;
&lt;li&gt;Interactive mode for browsing and transferring.&lt;/li&gt;
&lt;li&gt;Compatible with GUI clients like FileZilla and WinSCP.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slightly slower than SCP due to protocol overhead.&lt;/li&gt;
&lt;li&gt;Cannot transfer between two remote servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💙 Best Use Case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Since &lt;code&gt;sftp&lt;/code&gt; is a maintained SSH session, it is useful when there are a lot of small file transfers, and the folder structure is unknown.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  1.3 SSHFS (SSH Filesystem Mount)
&lt;/h3&gt;

&lt;p&gt;SSHFS mounts a remote filesystem locally using SSH and FUSE (Filesystem in Userspace). This allows you to use your existing tools and editors as if the files were on your machine.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Encrypted&lt;/th&gt;
&lt;th&gt;Resumable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SSH (with FUSE)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Mount remote filesystem&lt;/span&gt;
sshfs user@remote:/remote/path /local/mountpoint

&lt;span class="c"&gt;# Unmount&lt;/span&gt;
fusermount &lt;span class="nt"&gt;-u&lt;/span&gt; /local/mountpoint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transparent: Edit remote files with your local IDE/editor seamlessly.&lt;/li&gt;
&lt;li&gt;Secure by default via SSH.&lt;/li&gt;
&lt;li&gt;Great for exploratory work or ad-hoc editing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;High latency on every file operation (slow for reading many small files).&lt;/li&gt;
&lt;li&gt;Poor throughput for large files or bulk transfers.&lt;/li&gt;
&lt;li&gt;Requires sshfs and FUSE support.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💙 Best Use Case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sshfs&lt;/code&gt; is ideal for development workflows where convenience and direct file access matter more than transfer speed.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Rsync
&lt;/h2&gt;

&lt;p&gt;Rsync is optimized for synchronization and efficiency. Instead of re-copying everything, it calculates file checksums and only sends the differences (deltas). This delta-transfer algorithm, along with built-in compression and partial transfers, makes it a synchronization powerhouse.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Encrypted&lt;/th&gt;
&lt;th&gt;Resumable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SSH (default) or native TCP daemon&lt;/td&gt;
&lt;td&gt;Yes (if over SSH)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Sync local directory to remote (Archive, Verbose, Compress and Partial Transfer)&lt;/span&gt;
rsync &lt;span class="nt"&gt;-avzP&lt;/span&gt; local_dir/ user@remote:/path/to/dir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extremely efficient for repeated transfers (only sends deltas).&lt;/li&gt;
&lt;li&gt;Built-in compression (-z) and resumability.&lt;/li&gt;
&lt;li&gt;Preserves permissions, symlinks, and timestamps.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requires rsync on both machines.&lt;/li&gt;
&lt;li&gt;More CPU-intensive due to checksum calculations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💙 Best Use Case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;rsync&lt;/code&gt; is the go-to tool when you’re syncing directories with frequent updates or working with limited bandwidth where sending only changes matters most.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Performance Note:&lt;/strong&gt; For initial full transfers, rsync overhead (checksum calculations) makes it slightly slower than raw HTTP transfers. However, for incremental syncs with only changed files, rsync is dramatically faster since it only transfers deltas.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. HTTP(S) + Download Accelerators
&lt;/h2&gt;

&lt;p&gt;These methods prioritize raw speed by leveraging the lightweight nature of HTTP and the ability of clients to open parallel connections and partial downloads.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.1 HTTP Single-thread server (Python)
&lt;/h3&gt;

&lt;p&gt;Python's built-in HTTP server is the quickest way to share files. It serves the current directory over HTTP with zero configuration.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Encrypted&lt;/th&gt;
&lt;th&gt;Resumable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Server&lt;/span&gt;
python3 &lt;span class="nt"&gt;-m&lt;/span&gt; http.server 8000

&lt;span class="c"&gt;# Client&lt;/span&gt;
wget http://&amp;lt;server-public-ip&amp;gt;:8000/filename.ext
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Works out of the box.&lt;/li&gt;
&lt;li&gt;Faster than any of the SSH Tools, No SSH encryption/protocol overhead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single-threaded -&amp;gt; only one client at a time.&lt;/li&gt;
&lt;li&gt;No authentication.&lt;/li&gt;
&lt;li&gt;An SSH connection or a background job is required.&lt;/li&gt;
&lt;li&gt;One-way setup (server -&amp;gt; client).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💙 Best Use Case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transferring non-sensitive medium-sized files on a trusted local network for quick testing.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  3.2 HTTP Multi-thread server (BusyBox httpd)
&lt;/h3&gt;

&lt;p&gt;BusyBox's httpd is a lightweight, multi-threaded HTTP server that handles multiple concurrent connections, making it ideal for serving files to several clients simultaneously.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Encrypted&lt;/th&gt;
&lt;th&gt;Resumable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes (client-dependent)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Server&lt;/span&gt;
busybox httpd &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; 8000

&lt;span class="c"&gt;# Client&lt;/span&gt;
wget http://&amp;lt;server-public-ip&amp;gt;:8000/filename.ext

&lt;span class="c"&gt;# download-accelerators http://&amp;lt;server-public-ip&amp;gt;:8000/filename.ext&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Works out of the box.&lt;/li&gt;
&lt;li&gt;No SSH encryption overhead.&lt;/li&gt;
&lt;li&gt;Handles concurrent connections and multiple clients.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No authentication.&lt;/li&gt;
&lt;li&gt;An SSH connection or a background job is required.&lt;/li&gt;
&lt;li&gt;One-way setup (server -&amp;gt; client).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💙 Best Use Case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transferring non-sensitive large-sized files on a trusted local network for quick testing.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  3.2.1 Download Accelerators (aria2c, axel)
&lt;/h4&gt;

&lt;p&gt;Download accelerators are client-side tools that work with any HTTP/HTTPS server. They split downloads into multiple parallel streams, saturating your available bandwidth for maximum speed. These tools can be used with busybox httpd (3.3), or Caddy (3.4).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Encrypted&lt;/th&gt;
&lt;th&gt;Resumable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;HTTP/HTTPS&lt;/td&gt;
&lt;td&gt;Optional (HTTPS)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;aria2c:&lt;/strong&gt; multi-source, segmented downloads, resumable (&lt;code&gt;-c&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;axel:&lt;/strong&gt; lightweight, parallel streams, resumable, simpler than aria2c.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# busybox httpd (HTTP) (3.2)&lt;/span&gt;
aria2c &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; 8 &lt;span class="nt"&gt;-j&lt;/span&gt; 8 http://&amp;lt;server-public-ip&amp;gt;:8000/filename.ext

axel &lt;span class="nt"&gt;-n&lt;/span&gt; 8 http://&amp;lt;server-public-ip&amp;gt;:8000/filename.ext

&lt;span class="c"&gt;# Caddy (HTTPS) (3.3)&lt;/span&gt;
aria2c &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; 8 &lt;span class="nt"&gt;-j&lt;/span&gt; 8 &lt;span class="nt"&gt;--http-user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;username&amp;gt; &lt;span class="nt"&gt;--http-passwd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;password&amp;gt; &lt;span class="nt"&gt;--check-certificate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false &lt;/span&gt;https://&amp;lt;server-public-ip&amp;gt;/filename.ext

axel &lt;span class="nt"&gt;-n&lt;/span&gt; 8 &lt;span class="nt"&gt;-k&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Basic &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;username&amp;gt;:&amp;lt;password&amp;gt;'&lt;/span&gt; | &lt;span class="nb"&gt;base64&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; https://&amp;lt;server-public-ip&amp;gt;/filename.ext
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parallel streams saturate bandwidth.&lt;/li&gt;
&lt;li&gt;Built-in resume support.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Requires installation on client.&lt;/li&gt;
&lt;li&gt;Background server process needed.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  3.4 HTTPS File Server with Basic Auth (Caddy)
&lt;/h3&gt;

&lt;p&gt;A multi-threaded HTTP server is fast, but it is not secure. The final solution to file transferring is to go into overdrive mode and use a production server. Here, we are using Caddy for simplicity; we could have used NGINX and CertBot to accomplish the same.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Protocol&lt;/th&gt;
&lt;th&gt;Encrypted&lt;/th&gt;
&lt;th&gt;Resumable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;HTTPS&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Server&lt;/span&gt;
caddy hash-password &lt;span class="nt"&gt;--plaintext&lt;/span&gt; &amp;lt;password&amp;gt;
&lt;span class="c"&gt;# $2a$14$moXJYUFKt1w6d...&lt;/span&gt;
&lt;span class="nb"&gt;cat &lt;/span&gt;Caddyfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://localhost, https://127.0.0.1,  https://&amp;lt;server-public-ip&amp;gt; {
     tls internal

     root * /path/to/local_dir
     file_server browse

     basicauth {
        &amp;lt;username&amp;gt;  $2a$14$moXJYUFKt1w6d...
     }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;caddy run &lt;span class="nt"&gt;--config&lt;/span&gt; /path/to/Caddyfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Security Note:&lt;/strong&gt; The example below uses &lt;code&gt;--check-certificate=false&lt;/code&gt; because &lt;code&gt;tls internal&lt;/code&gt; in Caddy creates a self-signed certificate. In production, use proper certificates with Let's Encrypt (for public IPs with domain names) or an internal Certificate Authority.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Client&lt;/span&gt;

&lt;span class="c"&gt;# aria2c&lt;/span&gt;
aria2c &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; 8 &lt;span class="nt"&gt;--http-user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;username&amp;gt; &lt;span class="nt"&gt;--http-passwd&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;password&amp;gt; &lt;span class="nt"&gt;--check-certificate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false &lt;/span&gt;https://&amp;lt;server-public-ip&amp;gt;/filename.ext

&lt;span class="c"&gt;# axel&lt;/span&gt;
axel &lt;span class="nt"&gt;-n&lt;/span&gt; 8 &lt;span class="nt"&gt;-k&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Basic &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'&amp;lt;username&amp;gt;:&amp;lt;password&amp;gt;'&lt;/span&gt; | &lt;span class="nb"&gt;base64&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; https://&amp;lt;server-public-ip&amp;gt;/filename.ext
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication and encryption built-in.&lt;/li&gt;
&lt;li&gt;Supports parallel downloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;❌ Drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;More complex setup.&lt;/li&gt;
&lt;li&gt;One-way setup (server -&amp;gt; client).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💙 Best Use Case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sharing link for large files over the internet (with auth).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Security Considerations
&lt;/h2&gt;

&lt;p&gt;Understanding the security implications of each tool is critical when choosing a file transfer method:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SSH-Based Tools (SCP, SFTP, SSHFS, Rsync over SSH)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encrypted by default using SSH protocol&lt;/li&gt;
&lt;li&gt;Uses public key authentication (SSH keys) or password authentication&lt;/li&gt;
&lt;li&gt;Suitable for transferring sensitive data over untrusted networks&lt;/li&gt;
&lt;li&gt;Requires SSH access and proper key management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;HTTP Servers (Python, busybox)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No encryption - data transferred in plain text&lt;/li&gt;
&lt;li&gt;No authentication - anyone with network access can download files&lt;/li&gt;
&lt;li&gt;Use only on trusted local networks (VPNs, private subnets)&lt;/li&gt;
&lt;li&gt;Never use for sensitive data without additional security measures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;HTTPS (Caddy)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encrypted via TLS&lt;/li&gt;
&lt;li&gt;Basic Authentication sends credentials with every request&lt;/li&gt;
&lt;li&gt;Self-signed certificates (using &lt;code&gt;tls internal&lt;/code&gt;) trigger security warnings and require &lt;code&gt;--check-certificate=false&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;For production use, obtain proper certificates via Let's Encrypt or internal CA&lt;/li&gt;
&lt;li&gt;Suitable for transferring files over public networks when configured correctly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Best Practice:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use SSH-based tools for sensitive data over untrusted networks.&lt;/li&gt;
&lt;li&gt;HTTP servers are perfectly acceptable on trusted networks (VPNs, private subnets) where the network layer already provides security.&lt;/li&gt;
&lt;li&gt;Use HTTPS only when transferring files over public internet without VPN protection.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Performance Comparison: Slowest to Fastest
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;SSHFS&lt;/strong&gt;: High latency per operation, every read/write is a round-trip over SSH.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SCP/SFTP&lt;/strong&gt;: SSH encryption overhead, single-threaded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rsync over ssh&lt;/strong&gt;: Efficient delta transfers and compression.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP Single-Threaded&lt;/strong&gt;: Direct HTTP with no encryption overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTPS Multi-Threaded + Download Accelerators&lt;/strong&gt;: Parallel streams that saturate available bandwidth. HTTPS adds ~10-20% overhead.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  My Daily Workflow
&lt;/h2&gt;

&lt;p&gt;Here is what I use on a day-to-day basis:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scp&lt;/code&gt;: When transferring small files between VMs (and when I forgot rsync flags.)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sftp&lt;/code&gt;: When I have many small files to operate on, and I also don't know the directory structure, the command has fewer flags and is easier on fingers.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sshfs&lt;/code&gt;: Never used.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rsync over ssh&lt;/code&gt;: I have majorly replaced &lt;code&gt;scp&lt;/code&gt; with &lt;code&gt;rsync -aivP&lt;/code&gt; (I don't use compression &lt;strong&gt;on the fly&lt;/strong&gt;). It is especially handy with large files.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;python3 -m http.server 8000&lt;/code&gt;: Not anymore for my setup, but I am debugging someone else's setup, then they probably don't have download accelerators.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;busybox httpd -f -p 8000&lt;/code&gt;: Since most file transfer work happens over VPN with private endpoints. So for large files, this is my go-to choice.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;HTTPS File Server (Caddy)&lt;/code&gt;: Sending public links (outside VPN but still with user and password) for file download.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each tool addresses the same problem differently. By understanding their trade-offs, you can pick the right tool for your specific requirements instead of defaulting to SCP.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>opensource</category>
      <category>devops</category>
      <category>programming</category>
    </item>
    <item>
      <title>Alias Alchemy - Instant Bash Setup!</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Wed, 13 Aug 2025 18:35:33 +0000</pubDate>
      <link>https://dev.to/ra101/-4h2n</link>
      <guid>https://dev.to/ra101/-4h2n</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/ra101" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F471869%2F8c348996-72a9-461b-95d4-3b599df6284f.jpg" alt="ra101"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/ra101/alias-alchemy-instant-bash-setup-hcp" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Alias Alchemy - Instant Bash Setup!&lt;/h2&gt;
      &lt;h3&gt;Parth Agarwal ・ Aug 13 '25&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#bash&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#linux&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#opensource&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#kubernetes&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>bash</category>
      <category>linux</category>
      <category>opensource</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>Alias Alchemy - Instant Bash Setup!</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Wed, 13 Aug 2025 18:34:36 +0000</pubDate>
      <link>https://dev.to/ra101/alias-alchemy-instant-bash-setup-hcp</link>
      <guid>https://dev.to/ra101/alias-alchemy-instant-bash-setup-hcp</guid>
      <description>&lt;p&gt;&lt;strong&gt;Alias Alchemy&lt;/strong&gt; is a Deno-powered server that fetches aliases from a GitHub repository based on your query. Think of it as your instant alias spellbook, perfect for setting up new environments in seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚡ Usage:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;alias-alchemy.ra101.dev/?q&lt;span class="o"&gt;=&lt;/span&gt;py,shell,k8s &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; .aliases.sh
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; .aliases.sh

&lt;span class="c"&gt;# Python Aliases (py, py(uv), alembic, django, celery)&lt;/span&gt;
...

&lt;span class="c"&gt;# Shell Aliases (debian, git)&lt;/span&gt;
...

&lt;span class="c"&gt;# Kubernetes Aliases (kubectl, kubecolor, kustomize)&lt;/span&gt;
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🤔 Why I built it ?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;I constantly create new VMs at my job, and the very first command I run usually fails because it was an alias typed by pure muscle memory. Once you start using aliases, it is hard to write full commands, especially those &lt;a href="https://github.com/ra101/kubectl-aliases/blob/core/.kubectl_aliases.zsh" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt; aliases.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Whenever I start a new language, I start building aliases. For example, while learning Java (+ Maven), I made:&lt;br&gt;
&lt;code&gt;alias jexec = "mvn exec:java -Dexec.args=$@"&lt;/code&gt;.&lt;br&gt;
Since there’s no standard alias collection for most tools, I created Alias Alchemy to be that open-source standard — a handy tool for whenever someone starts something new.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I wanted to learn Deno, and this is my "hello-world" project.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  📖 Help Guide:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Enough Stories ! Let’s look at the help guide !&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The current version supports the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; alal.deno.dev/help

Alias Alchemy - The best way to download aliases &lt;span class="k"&gt;for &lt;/span&gt;fast setup.

USAGE:
    curl &lt;span class="nt"&gt;-L&lt;/span&gt; &lt;span class="s2"&gt;"alias-alchemy.ra101.dev/?q=&amp;lt;category-1&amp;gt;,&amp;lt;category-2&amp;gt;,..."&lt;/span&gt;

AVAILABLE CATEGORIES:
    , &lt;span class="o"&gt;(&lt;/span&gt;null&lt;span class="o"&gt;)&lt;/span&gt;                   All aliases
    shell, sh                  Shell aliases &lt;span class="o"&gt;(&lt;/span&gt;Debian, Git, utilities&lt;span class="o"&gt;)&lt;/span&gt;
    python, py                 Python aliases &lt;span class="o"&gt;(&lt;/span&gt;py, py&lt;span class="o"&gt;(&lt;/span&gt;uv&lt;span class="o"&gt;)&lt;/span&gt;, alembic, django, celery&lt;span class="o"&gt;)&lt;/span&gt;
    docker, dk                 Docker aliases &lt;span class="o"&gt;(&lt;/span&gt;docker, compose, swarm&lt;span class="o"&gt;)&lt;/span&gt;
    podman, pd                 Podman aliases &lt;span class="o"&gt;(&lt;/span&gt;podman, compose&lt;span class="o"&gt;)&lt;/span&gt;
    kubernetes, k              Kubernetes aliases &lt;span class="o"&gt;(&lt;/span&gt;kubectl, kubecolor, kustomize&lt;span class="o"&gt;)&lt;/span&gt;

SHORT DOMAIN:
    alal.deno.dev

SUPPORTED TOOLS:
    curl, wget, httpie, aria2, postman, or any tool with User-Agent: &lt;span class="s1"&gt;'alal'&lt;/span&gt;

For more information, visit: https://alias-alchemy.ra101.dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Website: &lt;a href="https://alias-alchemy.ra101.dev" rel="noopener noreferrer"&gt;https://alias-alchemy.ra101.dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Github Repo: &lt;a href="https://github.com/ra101/alias-alchemy" rel="noopener noreferrer"&gt;https://github.com/ra101/alias-alchemy&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>bash</category>
      <category>linux</category>
      <category>opensource</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>AI Hallucinations: A Future Full of Misconceptions and Mediocre Code</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Sat, 04 May 2024 15:30:35 +0000</pubDate>
      <link>https://dev.to/ra101/ai-hallucinations-mediocre-code-and-a-future-full-of-misconceptions-lcd</link>
      <guid>https://dev.to/ra101/ai-hallucinations-mediocre-code-and-a-future-full-of-misconceptions-lcd</guid>
      <description>&lt;p&gt;&lt;strong&gt;Reader discretion is advised!&lt;/strong&gt;&lt;br&gt;
A good Sus-Saturday to all. In this article, I drag and drown &lt;br&gt;
you with my paranoia about AI. Let the mass psychosis begin!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are AI hallucinations?&lt;/strong&gt;&lt;br&gt;
AI hallucinations are incorrect or misleading results that AI models generate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Story Time&lt;/strong&gt;&lt;br&gt;
I was looking for "colour quantization algorithms" for a project (I put these words together in my brain and it was an actual thing!). As the name suggests, I wanted to reduce the number of distinct colours in an image. Anyway, I googled it and all the answers were about the K-means clustering algorithm.&lt;/p&gt;

&lt;p&gt;Now, this algorithm is quite slow for my use case, So I went to chatGPT for the same, I spit out 5 different algorithms and out of them I selected the "Median Cut" algorithm and asked to write a code in Python, It returned a code using Pillow Library, I asked to re-write the code in using OpenCV and numpy, and it returned another piece of code.&lt;/p&gt;

&lt;p&gt;These 2 codes had slightly different implementations. None of them ran in the first go, but after some refactoring, they both yielded results! &lt;strong&gt;Different Results!&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;Okay, I already had the Algo's name, so I googled "median cut algorithm python" and I found a Github link, 2nd result. This code had different implementations! I can easily find papers and read articles about this algorithm and my issue will be resolved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's where the paranoia began!&lt;/strong&gt;&lt;br&gt;
What if this code is AI-generated? It is a 5-year-old code, so probably isn't. But 5 years down the line, Github will be full of mediocre code, full of misunderstood concepts. I see new junior engineers using ChatGPT daily to write small components of code. If there is some dumb code, PR reviewers will catch them. But After 7 years they will be managers and PR reviewers. What then?&lt;/p&gt;

&lt;p&gt;Today, every undergrad uses ChatGPT for his/her thesis. Heck, If I had access to it, I would have used it too. When these undergrads will do their PhD, will they use ChatGPT? Yes. From generating topics to writing abstracts and conclusions, even bibliographies, GPT can do it all.&lt;/p&gt;

&lt;p&gt;What about checking these papers? One can certainly make AI that could check these. Even if there was a law, that human review is required for any scientific report or article. A Lazy-Smart person will try and automate it. Guess what they would use? AI or Maths?&lt;/p&gt;

&lt;p&gt;We can just hope that any hallucinated or out-of-context/sarcastic reference which is interpreted as useful by Students' AI is caught with Teachers' AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BTW, This is what ChatGTP 3.5 has to say about it:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;gt; AI Hallucinations will lead to a mediocre future&lt;/p&gt;

&lt;p&gt;While AI hallucinations can be intriguing from a research perspective, they don't necessarily imply a "mediocre future" In fact, AI holds immense potential to revolutionize various fields, from healthcare to transportation, and from education to entertainment.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;AI being biased about AI is probably not ideal, I want my AI to be an insecure nerd (like me), not a confident politician/cult leader.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
With the invention of the Pen, We gained so much but We lost the power of memorization. With AI, rapid development is imminent, But I feel the loss will be far too much.&lt;/p&gt;

&lt;p&gt;We lost our muscles and survival instincts when we left the caves. Heck, Without a flint stone, It would take me ages to light a fire in camp. With mediocre code and misunderstood whitepapers, It seems the time for our brains to regress/halt has come.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Next?&lt;/strong&gt;&lt;br&gt;
What Next? Nothing mate! Even with all this said, AI will not stop, Skynet is inevitable. Let me give you a taste of what I feel, Ask yourself a simple question, &lt;strong&gt;Who wrote this article?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Boost your Git Squash-Rebase Workflow with these Commands! (auto-squash, auto-commit, auto-rebase, auto-push)</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Thu, 17 Aug 2023 07:51:01 +0000</pubDate>
      <link>https://dev.to/ra101/boost-your-git-squash-rebase-workflow-with-these-commands-auto-squash-auto-commit-auto-rebase-auto-push-foi</link>
      <guid>https://dev.to/ra101/boost-your-git-squash-rebase-workflow-with-these-commands-auto-squash-auto-commit-auto-rebase-auto-push-foi</guid>
      <description>&lt;p&gt;I recently joined a company, that follows squash-rebase flow here, and as my Git KT was going on, I figured I should build these commands before actually starting development, now that I have started development, these turned out to be quite handy!&lt;/p&gt;




&lt;h3&gt;
  
  
  What is Git Squash-Rebase Workflow?
&lt;/h3&gt;

&lt;p&gt;Git Squash Rebase is a workflow in which:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;multiple commits are squashed into a single cohesive commit,&lt;/li&gt;
&lt;li&gt;then rebased from the up-to-date main branch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This results in a cleaner commit history, grouping of changes, easier code reviews, and streamlined collaboration. &lt;em&gt;Of-course there are some drawbacks of this workflow, but that is beyond the scope of this post.&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Git Squash (&lt;code&gt;gsq&lt;/code&gt;):
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gsq&lt;span class="o"&gt;(){&lt;/span&gt;
    &lt;span class="c"&gt;# Usage:&lt;/span&gt;
    &lt;span class="c"&gt;## gsq -b "base_branch_opt" -n "squash_count_opt" -m "msg" -d "desc" -D&lt;/span&gt;
    &lt;span class="c"&gt;##&lt;/span&gt;
    &lt;span class="c"&gt;##    -b: Base Branch Name (default: default origin branch)&lt;/span&gt;
    &lt;span class="c"&gt;##    -n: Squash Count (default: all until base branch)&lt;/span&gt;
    &lt;span class="c"&gt;##    -m: Commit Message, (default: latest commit message)&lt;/span&gt;
    &lt;span class="c"&gt;##        - Uses Auto Commit Command, if present.&lt;/span&gt;
    &lt;span class="c"&gt;##    -d: Commit Description, (default: null)&lt;/span&gt;
    &lt;span class="c"&gt;##    -D: if passed, the description is populated with all the previous commit msg and desc until sqaush_count&lt;/span&gt;

    &lt;span class="c"&gt;# Get Base Branch -&amp;gt; Get Fork Point -&amp;gt; Get Squashable Count -&amp;gt; Squash!&lt;/span&gt;

    &lt;span class="c"&gt;## Even though this command seems big, but the flow is pretty simple.&lt;/span&gt;
    &lt;span class="c"&gt;## I use a very lite version of this code, there is alot of validation and&lt;/span&gt;
    &lt;span class="c"&gt;## edges cases here, which is not particularly I care about in my personal use.&lt;/span&gt;

    &lt;span class="c"&gt;# Declare Local Var&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;base_branch_opt&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;local &lt;/span&gt;squash_count_opt&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;local &lt;/span&gt;commit_msg_opt&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;commit_desc_opt&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;add_full_desc_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c"&gt;# Get Optional Arguments!&lt;/span&gt;

    &lt;span class="c"&gt;## Reset the getopts state&lt;/span&gt;
    &lt;span class="nv"&gt;OPTIND&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
    &lt;span class="c"&gt;## Parse Through new opts.&lt;/span&gt;
    &lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nb"&gt;getopts &lt;/span&gt;b:n:m:d:D flag
    &lt;span class="k"&gt;do
        case&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;flag&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="k"&gt;in
            &lt;/span&gt;b&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;base_branch_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;OPTARG&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
            n&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;squash_count_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;OPTARG&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
            m&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;commit_msg_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;OPTARG&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
            d&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;commit_desc_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;OPTARG&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
            D&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;add_full_desc_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
        &lt;span class="k"&gt;esac&lt;/span&gt;
    &lt;span class="k"&gt;done&lt;/span&gt;

    &lt;span class="c"&gt;# Get Base Branch&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;

    &lt;span class="c"&gt;## Update base_branch_opt with default origin branch, if not passed!&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;current_branch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git rev-parse &lt;span class="nt"&gt;--abbrev-ref&lt;/span&gt; HEAD&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$base_branch_opt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nv"&gt;base_branch_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git symbolic-ref refs/remotes/origin/HEAD | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="s1"&gt;'s@^refs/remotes/origin/@@'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;fi&lt;/span&gt;

    &lt;span class="c"&gt;# Get Fork Point Commit&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;

    &lt;span class="c"&gt;# Check if given base branch is actually an ancestor or not.&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;fork_point_commit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt; git branch &lt;span class="nt"&gt;--merged&lt;/span&gt; HEAD 2&amp;gt; /dev/null | &lt;span class="nb"&gt;sed&lt;/span&gt;  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'s/* \(.*\)/ \1/'&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt;  &lt;span class="s1"&gt;'s/^ *//g'&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$base_branch_opt&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
        &lt;span class="c"&gt;### Get the Last commit by `base_branch_opt`&lt;/span&gt;
        &lt;span class="nv"&gt;fork_point_commit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git merge-base &lt;span class="nt"&gt;--fork-point&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$base_branch_opt&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;
        &lt;span class="c"&gt;### Throw Error if Base Branch is not found as an ancestor.&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Invalid Base Branch! "&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="k"&gt;return &lt;/span&gt;1
    &lt;span class="k"&gt;fi&lt;/span&gt;

    &lt;span class="c"&gt;# Get Squashable Count&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;
    &lt;span class="c"&gt;## Exit, if Squashable Count is 0!&lt;/span&gt;
    &lt;span class="c"&gt;## We are okay with squashing 1 commit, the reason for that is, this allows us&lt;/span&gt;
    &lt;span class="c"&gt;## to stage the changes and use `gsq` to commit those changes into squashed commit&lt;/span&gt;


    &lt;span class="c"&gt;## squashable_count: Number of commits that can be to be squashed&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;current_commit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git rev-parse HEAD&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;squashable_count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git rev-list &lt;span class="nt"&gt;--count&lt;/span&gt; &lt;span class="nv"&gt;$fork_point_commit&lt;/span&gt;..&lt;span class="nv"&gt;$current_commit&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;## Exit, if passed squash_count_opt is `0` or not a `number`!&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$squash_count_opt&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nv"&gt;$squash_count_opt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;~ ^[0-9]+&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nv"&gt;$squash_count_opt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; 0 &lt;span class="o"&gt;)]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Invalid Squash Count &lt;/span&gt;&lt;span class="nv"&gt;$squash_count_opt&lt;/span&gt;&lt;span class="s2"&gt;! "&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="k"&gt;return &lt;/span&gt;1
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$squash_count_opt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;  &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
      &lt;/span&gt;&lt;span class="nv"&gt;squash_count_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$squashable_count&lt;/span&gt;
    &lt;span class="k"&gt;fi&lt;/span&gt;

    &lt;span class="c"&gt;## Exit, if found `squashable_count` turns about to be `0` !&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$squashable_count&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"0"&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Nothing to Squash! "&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="k"&gt;return &lt;/span&gt;1
    &lt;span class="k"&gt;fi&lt;/span&gt;

    &lt;span class="c"&gt;## Squash Count Passed cannot be more than Squashable Count found!&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$squashable_count&lt;/span&gt; &amp;lt; &lt;span class="nv"&gt;$squash_count_opts&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Cannot Squash more than &lt;/span&gt;&lt;span class="nv"&gt;$squashable_count&lt;/span&gt;&lt;span class="s2"&gt;! "&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="k"&gt;return &lt;/span&gt;1
    &lt;span class="k"&gt;fi&lt;/span&gt;

    &lt;span class="c"&gt;# Squash!: Get Commit Message and Description.&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;

    &lt;span class="c"&gt;## Get Commit Message, (Default: title from latest commit)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$commit_msg_opt&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
      &lt;/span&gt;&lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;commit_message&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$commit_msg_opt&lt;/span&gt;
    &lt;span class="k"&gt;else
      &lt;/span&gt;&lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;commit_message&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git log &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"%s"&lt;/span&gt; &lt;span class="nt"&gt;-n1&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;fi&lt;/span&gt;

    &lt;span class="c"&gt;## Get Full Commit Description, (Default: raw body from last n commit)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$add_full_desc_opt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
      if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$commit_desc_opt&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nv"&gt;commit_desc_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$commit_desc_opt&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git log &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'%B'&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt;&lt;span class="nv"&gt;$squash_count_opt&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
      &lt;span class="k"&gt;else
        &lt;/span&gt;&lt;span class="nv"&gt;commit_desc_opt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git log &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'%B'&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt;&lt;span class="nv"&gt;$squash_count_opt&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
      &lt;span class="k"&gt;fi
    fi&lt;/span&gt;

    &lt;span class="c"&gt;## create commit_desc_if_there if commit_desc_opt is populated&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;commit_desc_if_there&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$commit_desc_opt&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
      &lt;/span&gt;&lt;span class="nv"&gt;commit_desc_if_there&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"-m '&lt;/span&gt;&lt;span class="nv"&gt;$commit_desc_opt&lt;/span&gt;&lt;span class="s2"&gt;'"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;fi&lt;/span&gt;

    &lt;span class="c"&gt;# Squash!: Reset Commits Softly before commiting back.&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;

    &lt;span class="c"&gt;## Normally Squashing is done using rebase,&lt;/span&gt;
    &lt;span class="c"&gt;## but I could not automate its interactive shell.&lt;/span&gt;
    git reset &lt;span class="nt"&gt;--soft&lt;/span&gt; HEAD~&lt;span class="nv"&gt;$squash_count_opt&lt;/span&gt;

    &lt;span class="c"&gt;# Squash!: Commit to complete squashing!&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;

    &lt;span class="c"&gt;## Use Auto Commit Command if There, Else use Default `git commit`&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$commit_msg_opt&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; gac&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;gac &lt;span class="nv"&gt;$commit_desc_if_there&lt;/span&gt;
    &lt;span class="k"&gt;else
        &lt;/span&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$commit_message&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nv"&gt;$commit_desc_if_there&lt;/span&gt;
    &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Git Auto Commit (&lt;code&gt;gac&lt;/code&gt;):
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gac&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;## The Idea is to create a commit message from branch name&lt;/span&gt;
    &lt;span class="c"&gt;## For Example:&lt;/span&gt;
    &lt;span class="c"&gt;##    if branch name is `feature/jira-123-this-is-issue-desc`&lt;/span&gt;
    &lt;span class="c"&gt;##    then commit would be `[Enhancement JIRA-123] This Is Issue Desc`&lt;/span&gt;

    &lt;span class="c"&gt;# Exit, if there is nothing to commit!&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;git diff &lt;span class="nt"&gt;--staged&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Nothing to Commit! "&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="k"&gt;return &lt;/span&gt;1
    &lt;span class="k"&gt;fi&lt;/span&gt;


    &lt;span class="c"&gt;# Fetch Details&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;

    &lt;span class="c"&gt;## `feature/jira-123-this-is-issue-desc`, all in lower case&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;current_branch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git rev-parse &lt;span class="nt"&gt;--abbrev-ref&lt;/span&gt; HEAD | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="s1"&gt;'[:upper:]'&lt;/span&gt; &lt;span class="s1"&gt;'[:lower:]'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;## `feature`&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;issue_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$current_branch&lt;/span&gt; | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 1&lt;span class="si"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;## `jira-123`&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;issue_no&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$current_branch&lt;/span&gt; | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 2- | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'-'&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nt"&gt;-2&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;## `this-is-issue-desc`&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;issue_desc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$current_branch&lt;/span&gt; | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 2- | &lt;span class="nb"&gt;cut&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'-'&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; 3- &lt;span class="si"&gt;)&lt;/span&gt;


    &lt;span class="c"&gt;# Format Details&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;

    &lt;span class="c"&gt;## We will use this map to get issue_type out of branch name&lt;/span&gt;
    &lt;span class="nb"&gt;declare&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; branch_map&lt;span class="p"&gt;;&lt;/span&gt; branch_map[&lt;span class="s2"&gt;"feature"&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;"Enhancement"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    branch_map[&lt;span class="s2"&gt;"bugfix"&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;"Patch"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; branch_map[&lt;span class="s2"&gt;"version"&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;"Upgrade"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c"&gt;## `feature` -&amp;gt; `Enhancement`; `random` -&amp;gt; `Random`&lt;/span&gt;
    &lt;span class="nv"&gt;issue_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;branch_map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$issue_type&lt;/span&gt;&lt;span class="p"&gt;]-&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;issue_type&lt;/span&gt;&lt;span class="p"&gt;^&lt;/span&gt;&lt;span class="k"&gt;}}&lt;/span&gt;

    &lt;span class="c"&gt;## `jira-123` -&amp;gt; `JIRA-123`&lt;/span&gt;
    &lt;span class="nv"&gt;issue_no&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$issue_no&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="s1"&gt;'[:lower:]'&lt;/span&gt; &lt;span class="s1"&gt;'[:upper:]'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;## `this-is-issue-desc` -&amp;gt; `This Is Issue Desc`&lt;/span&gt;
    &lt;span class="nv"&gt;issue_desc&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$issue_desc&lt;/span&gt; | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="s1"&gt;'s/-/ /g'&lt;/span&gt; | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{for (i=1; i&amp;lt;=NF; i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

    &lt;span class="c"&gt;## `[Enhancement JIRA-123] This Is Issue Desc`&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;commit_msg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"[&lt;/span&gt;&lt;span class="nv"&gt;$issue_type&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$issue_no&lt;/span&gt;&lt;span class="s2"&gt;] &lt;/span&gt;&lt;span class="nv"&gt;$issue_desc&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

    &lt;span class="c"&gt;# Commit!&lt;/span&gt;
    &lt;span class="c"&gt;# ----------------&lt;/span&gt;

    &lt;span class="c"&gt;## Along with this message, I have added $@, So that all the&lt;/span&gt;
    &lt;span class="c"&gt;## flags and arguments of `git commit` can be passed in this command.&lt;/span&gt;
    git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$commit_msg&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nv"&gt;$@&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Git Fetch Rebase (&lt;code&gt;gfrb&lt;/code&gt;):
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gfrb&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;## If $1 is not passed, then it will fetch the default branch&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;base_branch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git symbolic-ref refs/remotes/origin/HEAD | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="s1"&gt;'s@^refs/remotes/origin/@@'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;
    git fetch origin &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$base_branch&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$base_branch&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

    &lt;span class="c"&gt;## Rebase requires stashing, but any file that has both&lt;/span&gt;
    &lt;span class="c"&gt;## staged and unstaged changes will lose all its&lt;/span&gt;
    &lt;span class="c"&gt;## unstaged changes! So uncomment at your own risk.&lt;/span&gt;

    &lt;span class="c"&gt;# git stash --all&lt;/span&gt;

    git rebase &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$base_branch&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

    &lt;span class="c"&gt;# git stash pop&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Git Upstream Push (&lt;code&gt;gup&lt;/code&gt;):
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gup&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;## Although `--force` is frequently used in this workflow.&lt;/span&gt;
    &lt;span class="c"&gt;## It still feels destructive to add here.&lt;/span&gt;
    &lt;span class="c"&gt;## Instead I have added $@, So that all the `git push` &lt;/span&gt;
    &lt;span class="c"&gt;## flags and arguments can be passed in this command.&lt;/span&gt;
    &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;current_branch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git rev-parse &lt;span class="nt"&gt;--abbrev-ref&lt;/span&gt; HEAD&lt;span class="si"&gt;)&lt;/span&gt;
    git push &lt;span class="nt"&gt;--set-upstream&lt;/span&gt; origin &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$current_branch&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nv"&gt;$@&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Update your &lt;code&gt;~/.[ba|z]shrc&lt;/code&gt; with these productive commands and save those few minutes. Happy Commiting!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You also might like these:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check out my gist (&lt;a href="https://gist.github.com/ra101/70ea4389ba04bf6d5a172d9a3000e5f7" rel="noopener noreferrer"&gt;alias.sh&lt;/a&gt;) for a big list of aliases for git, python, Django, and docker.&lt;/li&gt;
&lt;li&gt;Made a meme into reality - &lt;a href="https://dev.to/ra101/new-bash-alias-git-out-2603"&gt;New Bash Alias: Git Out&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;And Finally, a fun video - &lt;a href="https://www.youtube.com/watch?v=z0-Rw7guZDY" rel="noopener noreferrer"&gt;Bash Script: Enjoy the Little Things!&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;PS: Feel free to share your productivity Hack!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>productivity</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
    <item>
      <title>AR Portfolio App</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Thu, 07 Apr 2022 13:40:21 +0000</pubDate>
      <link>https://dev.to/ra101/ar-portfolio-app-bld</link>
      <guid>https://dev.to/ra101/ar-portfolio-app-bld</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/gEvrnAHbdMw"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;A Personalized Visiting Card that floats in AR space.&lt;/p&gt;

&lt;p&gt;source_code, documentation, download: &lt;a href="https://ar.ra101.dev" rel="noopener noreferrer"&gt;https://ar.ra101.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>unity3d</category>
      <category>ar</category>
      <category>showdev</category>
    </item>
    <item>
      <title>AR Card | AR Portfolio App</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Thu, 07 Apr 2022 13:33:37 +0000</pubDate>
      <link>https://dev.to/ra101/ar-card-ar-portfolio-app-437f</link>
      <guid>https://dev.to/ra101/ar-card-ar-portfolio-app-437f</guid>
      <description>&lt;p&gt;A Personalized Visiting Card that floats in AR space.&lt;/p&gt;

&lt;p&gt;source_code, documentation, download: &lt;a href="https://ar.ra101.dev" rel="noopener noreferrer"&gt;https://ar.ra101.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ar</category>
      <category>blender</category>
      <category>unity3d</category>
      <category>showdev</category>
    </item>
    <item>
      <title>How to Write a C++ Library</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Tue, 22 Feb 2022 21:24:08 +0000</pubDate>
      <link>https://dev.to/ra101/namespace-ra-how-to-write-c-library-4a4c</link>
      <guid>https://dev.to/ra101/namespace-ra-how-to-write-c-library-4a4c</guid>
      <description>&lt;p&gt;Prerequisite: One must be familiar with coding in &lt;code&gt;C++&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;I coded my first &lt;code&gt;C++&lt;/code&gt; libraries 5 years back, I had just started college, and wanted to do something solid!, One fine evening, I was looking back at that code, It was so, poorly written, So I started fixing it. I googled &lt;code&gt;C++&lt;/code&gt; Convention, After many search results, I found out there are no good resources out there. So I took upon myself, To Write One!&lt;/p&gt;

&lt;p&gt;These are coding practices one may follow to write readable good code.&lt;/p&gt;




&lt;h3&gt;
  
  
  File Types:
&lt;/h3&gt;

&lt;p&gt;Any programing file, in the end, is nothing but a text file with a fancy extension. In the Book of Genesis, the mentioned naming style is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.c&lt;/code&gt; for &lt;code&gt;C&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.cpp&lt;/code&gt; for &lt;code&gt;C++&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.h&lt;/code&gt; for headers (independent of &lt;code&gt;C&lt;/code&gt; or &lt;code&gt;C++&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But due to the opensource nature of GNU, A bunch of different assembler and compilers were made which came with their own extensions variations, such as, &lt;code&gt;.cc&lt;/code&gt;, &lt;code&gt;.C&lt;/code&gt;, &lt;code&gt;.cxx&lt;/code&gt;, &lt;code&gt;.c++&lt;/code&gt; and &lt;code&gt;.hh&lt;/code&gt;, &lt;code&gt;.H&lt;/code&gt;, &lt;code&gt;.hxx&lt;/code&gt;, &lt;code&gt;.hpp&lt;/code&gt;, &lt;code&gt;.h++&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;TBH, Just chose one set of extensions, after all, even &lt;code&gt;.txt&lt;/code&gt; can be compiled.&lt;/p&gt;

&lt;p&gt;I use, (Since Most IDE recognize them):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;.c&lt;/code&gt; for &lt;code&gt;C&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.cpp&lt;/code&gt; for &lt;code&gt;C++&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.h&lt;/code&gt; for &lt;code&gt;C&lt;/code&gt; headers&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.hpp&lt;/code&gt; for &lt;code&gt;C++&lt;/code&gt; headers&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  &lt;code&gt;makefile&lt;/code&gt;:
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;makefile&lt;/code&gt; is a special file, containing shell commands, that you create and name &lt;code&gt;makefile&lt;/code&gt; (no extensions)&lt;/p&gt;

&lt;p&gt;It is executed using the &lt;code&gt;make&lt;/code&gt; command. My Typical makefile looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Variables&lt;/span&gt;
&lt;span class="nv"&gt;CXX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;g++
&lt;span class="nv"&gt;CXXFLAGS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;-std&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;c++11 &lt;span class="nt"&gt;-w&lt;/span&gt;

&lt;span class="c"&gt;# &amp;lt;command&amp;gt; : &amp;lt;dependencies&amp;gt;&lt;/span&gt;

&lt;span class="c"&gt;# would have worked with main.cpp as well, added rest of&lt;/span&gt;
&lt;span class="c"&gt;# dependencies to add a check before compiler returns an error.&lt;/span&gt;
build: main.cpp local_header.hpp includes/external_lib.hpp 
    @echo &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;main.cpp: Building..."&lt;/span&gt;
    &lt;span class="si"&gt;$(&lt;/span&gt;CXX&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;CXXFLAGS&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; main.out main.cpp

run: main.out
    @echo &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;main.cpp: Executing..."&lt;/span&gt;
    ./main.out

clean: main.out
    @echo &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;main.cpp: Cleaning..."&lt;/span&gt;
    &lt;span class="nb"&gt;rm &lt;/span&gt;main.out

&lt;span class="c"&gt;# test command is for show, I have probably never used it 😅😂 &lt;/span&gt;
&lt;span class="nb"&gt;test&lt;/span&gt;: test.cpp
    @echo &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;test.cpp: Building..."&lt;/span&gt;
    &lt;span class="si"&gt;$(&lt;/span&gt;CXX&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;CXXFLAGS&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; test.out test.cpp
    @echo &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;test.cpp: Executing..."&lt;/span&gt;
    ./test.out
    @echo &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;test.cpp: Cleaning..."&lt;/span&gt;
    &lt;span class="nb"&gt;rm&lt;/span&gt; ./test.out

all: build run clean
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="c"&gt;# To build, run and clean the main.cpp&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;make all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/pauljlucas"&gt;@pauljlucas&lt;/a&gt; suggested:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You really should use something like &lt;a href="https://www.gnu.org/software/automake/" rel="noopener noreferrer"&gt;GNU Automake&lt;/a&gt; or &lt;a href="https://cmake.org/" rel="noopener noreferrer"&gt;CMake&lt;/a&gt; instead of hand-written makefiles. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;These tools may add overhead of other files, but these files are informative files. Use these tools, if they benefit your project.&lt;/p&gt;

&lt;p&gt;NOTE: use &lt;code&gt;-MMD&lt;/code&gt; flag to get a &lt;code&gt;.d&lt;/code&gt; file, containing all dependencies.&lt;/p&gt;




&lt;h3&gt;
  
  
  PreProcessors:
&lt;/h3&gt;

&lt;p&gt;The preprocessors are the directives, which instruct the compiler to preprocess the information before starting compilation. All preprocessors start with &lt;code&gt;#&lt;/code&gt;, For example: &lt;code&gt;#include&amp;lt;iosteam&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;These are the coding practices, I use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Double Quotes (&lt;code&gt;"..."&lt;/code&gt;) for including local headers, This rule increases readability of Code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;3 Levels of includes (I picked this habit while working in python) with line-space between them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, for core &lt;code&gt;g++&lt;/code&gt; system files.&lt;/li&gt;
&lt;li&gt;Second, for externally added libraries.&lt;/li&gt;
&lt;li&gt;Third, for locally created files.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/pauljlucas"&gt;@pauljlucas&lt;/a&gt; suggested:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You should include local headers first — &lt;em&gt;then&lt;/em&gt; system headers. The reason is to guarantee that all local headers are self-sufficient&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;By "self-sufficient", Xe means, local headers are not depending on System or External libraries of this file.&lt;br&gt;
This although is a good way of checking, I believe this "check" is not something headers/compilers should do, well at least not at the file level.&lt;br&gt;
In an ideal world, Each header would have its own test files to resolve this, until then, going against the natural order might not be that bad.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;#pragma one&lt;/code&gt; for &lt;strong&gt;header files&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What &lt;code&gt;#include&lt;/code&gt; does is that it adds the mentioned file at the top of the code (you can check it by using &lt;code&gt;--save-temp&lt;/code&gt; flag during compiling) So, If a header file is called again somewhere else, The Whole Code will be compiled again. Since Header files don't typically initiate a variable. It is Advised to compile it once for performance enhancement.&lt;/li&gt;
&lt;li&gt;One can use &lt;code&gt;#indef ... #include ... #endif&lt;/code&gt;, but it is tedious, so&lt;code&gt;#pragma once&lt;/code&gt; reduces possibilities for bugs due to manual mishandling.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DO NOT USE &lt;code&gt;using namespace ...&lt;/code&gt; in &lt;strong&gt;header file&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It may lead to a re-declaration error.&lt;/li&gt;
&lt;li&gt;It may populate the header file with its function&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SO, According to the above rules, A good &lt;strong&gt;header&lt;/strong&gt; would be.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#pragma once // 2 line-space afterwards
&lt;/span&gt;

&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;system_file_1&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;system_file_2&amp;gt;&lt;/span&gt;&lt;span class="c1"&gt; // 1 line-space afterwards&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;external_lib1_1&amp;gt;&lt;/span&gt;&lt;span class="c1"&gt; // 1 line-space afterwards&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;external_lib2_2&amp;gt;&lt;/span&gt;&lt;span class="c1"&gt; // club external libs together&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt;&lt;span class="cpf"&gt;&amp;lt;external_lib2_3&amp;gt;&lt;/span&gt;&lt;span class="c1"&gt; // 1 line-space afterwards&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"local_file"&lt;/span&gt;&lt;span class="c1"&gt; // 2 line-space afterwards&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;

&lt;span class="c1"&gt;// using namespace ... DO NOT USE IN HEADERS&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;ra&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Nomenclature:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  File | &lt;code&gt;namespace&lt;/code&gt; | &lt;code&gt;Class&lt;/code&gt; | &lt;code&gt;function&lt;/code&gt;:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Nothing is fixed, one may use &lt;code&gt;camelCase&lt;/code&gt;, &lt;code&gt;PascalCase&lt;/code&gt; or
&lt;code&gt;snake_case&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;I personally find &lt;code&gt;snake_case&lt;/code&gt; to be more readable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;Template&lt;/code&gt; Parameter:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;same as above, no rules.&lt;/li&gt;
&lt;li&gt;I prefer &lt;code&gt;PascalCase&lt;/code&gt; here.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Constants | Macros:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;UPPER_SNAKE_CASE&lt;/code&gt; is preferred everywhere.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Variables:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Before IDE(s) were a thing, People just couldn't hover over variables to get info. So some old libraries use the following conventions:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;m_&amp;lt;any case&amp;gt;&lt;/code&gt; for private members:&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;t_&amp;lt;any case&amp;gt;&lt;/code&gt; for function parameters&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;I personally, discard this rule.&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Taboo of Naming:
&lt;/h4&gt;

&lt;p&gt;Check this &lt;a href="https://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Comments:
&lt;/h3&gt;

&lt;p&gt;C++ allows for 2 types of comments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// This is single line Comment&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cm"&gt;/*
...
This is Multi-Line Comment
...
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generally speaking, single-line comments provide more control over the appearance and are &lt;em&gt;considered&lt;/em&gt; better.&lt;/p&gt;

&lt;p&gt;As a python developer, I wholeheartedly disagree, This is how I prefer my code!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;custom_class&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/*
        A definition of what does this class represent
        - Preferred Usage:
            ...
    */&lt;/span&gt;
    &lt;span class="nl"&gt;private:&lt;/span&gt;
        &lt;span class="c1"&gt;// How this variable affects / Where this may be used&lt;/span&gt;
        &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;variable&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;3.14&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;

        &lt;span class="c1"&gt;// What does this function do&lt;/span&gt;
        &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;function&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;custom_class&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="cm"&gt;/*
        A definition of what does this function do
        - Input: ...
        - Output: ...
    */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;






&lt;h3&gt;
  
  
  Custom Exceptions:
&lt;/h3&gt;

&lt;p&gt;Custom exceptions provide you the flexibility to add attributes and methods that are not part of a standard programming language. These are most helpful in Debugging when code is unable to compile.&lt;/p&gt;

&lt;p&gt;Below is My Favorite Exception:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Code&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;ra&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;external_exception&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;logic_error&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;public:&lt;/span&gt;
        &lt;span class="n"&gt;external_exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;__builtin_FUNCTION&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;logic_error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"`"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"` called for external exception!"&lt;/span&gt;&lt;span class="p"&gt;){};&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Usage&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt; &lt;span class="p"&gt;(){&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;ra&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;external_exception&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Output&lt;/span&gt;

terminate called after throwing an instance of &lt;span class="s1"&gt;'ra::external_exception'&lt;/span&gt;
  what&lt;span class="o"&gt;()&lt;/span&gt;:  &lt;span class="sb"&gt;`&lt;/span&gt;main&lt;span class="sb"&gt;`&lt;/span&gt; called &lt;span class="k"&gt;for &lt;/span&gt;external exception!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let me explain, In argument of constructor of exception it says:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;__builtin_FUNCTION&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;__builtin_FUNCTION()&lt;/code&gt; return the source location, when called.&lt;/p&gt;

&lt;p&gt;Since called in Argument, whenever it is initiated that is the source location, Essentially Making it a traceable Exception&lt;/p&gt;

&lt;p&gt;Here We have inherited from &lt;code&gt;logic_error&lt;/code&gt;, but other exceptions/errors could be found &lt;a href="https://en.cppreference.com/w/cpp/header/stdexcept" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;NOTE: In C++ Exceptions and Errors are the same, but in theory, Exceptions are something that could be handled, whereas errors should not be as they break the system.&lt;/p&gt;




&lt;h3&gt;
  
  
  Modularity
&lt;/h3&gt;

&lt;p&gt;A Modular design is shown to improve the design process by allowing better re-usability, relatively low maintenance, workload handling, and easier debugging processes. Modularity in &lt;code&gt;C++&lt;/code&gt; can be achieved by the following &lt;/p&gt;

&lt;h4&gt;
  
  
  Template
&lt;/h4&gt;

&lt;p&gt;As defined &lt;a href="https://www.javatpoint.com/cpp-templates" rel="noopener noreferrer"&gt;here&lt;/a&gt; :  A C++ template is a powerful feature added to C++. It allows you to define the generic classes and generic functions and thus provides support for generic programming. Generic programming is a technique where generic types are used as parameters in algorithms so that they can work for a variety of data types&lt;/p&gt;

&lt;p&gt;Templates can be represented in two ways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://en.cppreference.com/w/cpp/language/function_template" rel="noopener noreferrer"&gt;Function templates&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="nc"&gt;TemplateKlass&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;TemplateKlass&lt;/span&gt; &lt;span class="nf"&gt;get_maximum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TemplateKlass&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;TemplateKlass&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://en.cppreference.com/w/cpp/language/templates" rel="noopener noreferrer"&gt;Class templates&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="nc"&gt;TemplateKlass&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;custom_class&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;private:&lt;/span&gt;
    &lt;span class="n"&gt;TemplateKlass&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
    &lt;span class="n"&gt;custom_class&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TemplateKlass&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;TemplateKlass&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I am will not into details, As there are far better resources&lt;/p&gt;

&lt;h4&gt;
  
  
  Function as Argument:
&lt;/h4&gt;

&lt;p&gt;We can pass a function in the argument of another function, Well Actually A function pointer is passed to be exact. This comes in handy in the situation, where you have multiple services for the same request, for example, &lt;strong&gt;Hashing&lt;/strong&gt;, you can use so many third-party algorithms for hashing.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="nf"&gt;verify_hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;hash_func&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
    &lt;span class="cm"&gt;/*
        This will take in any function with
        input and output as a string 
    */&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;hashed_output&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;hash_func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Inheritance
&lt;/h4&gt;

&lt;p&gt;I picked up this in my &lt;code&gt;Unity3D&lt;/code&gt; days, In &lt;code&gt;Unity3D&lt;/code&gt; Almost everything is inherited and then used.&lt;/p&gt;

&lt;p&gt;The plan is simple, Create a class with a bunch of public members all throwing error.&lt;/p&gt;

&lt;p&gt;And Then Everyone would have to Inherit that class and override it.&lt;/p&gt;

&lt;p&gt;For Example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;base_class&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/*
        Everyone will inherit from this class
    */&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
    &lt;span class="n"&gt;base_class&lt;/span&gt;&lt;span class="p"&gt;(){}&lt;/span&gt;
    &lt;span class="n"&gt;base_class&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;not_implemented_exception&lt;/span&gt;&lt;span class="p"&gt;();}&lt;/span&gt;

    &lt;span class="k"&gt;virtual&lt;/span&gt; &lt;span class="k"&gt;operator&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="k"&gt;operator&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;base_class&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;not_implemented_exception&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="nc"&gt;TemplateKlass&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;some_func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TemplateKlass&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;not_implemented_exception&lt;/span&gt;&lt;span class="p"&gt;();}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;extended_class&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;base_class&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/*
        This is how Inheritance would work
    */&lt;/span&gt;
&lt;span class="nl"&gt;private:&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;m_temp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
    &lt;span class="n"&gt;extended_class&lt;/span&gt;&lt;span class="p"&gt;(){}&lt;/span&gt;
    &lt;span class="n"&gt;extended_class&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;t_temp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;m_temp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t_temp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;operator&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t_temp&lt;/span&gt;&lt;span class="p"&gt;);}&lt;/span&gt;

    &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="k"&gt;operator&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;extended_class&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;m_temp&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;m_temp&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="nc"&gt;TemplateKlass&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;some_func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TemplateKlass&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{...}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Bonus: Icon Pack!
&lt;/h3&gt;

&lt;p&gt;Yeah... I created my own icons too...&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;GNU Extension&lt;/th&gt;
&lt;th&gt;Preview&lt;/th&gt;
&lt;th&gt;Download&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;.c&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ra101.github.io/namespace-ra/assets/c.png" rel="noopener noreferrer"&gt;c.png&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ra101.github.io/namespace-ra/assets/c.ico" rel="noopener noreferrer"&gt;c.ico&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;.cpp&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ra101.github.io/namespace-ra/assets/cpp.png" rel="noopener noreferrer"&gt;cpp.png&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ra101.github.io/namespace-ra/assets/cpp.ico" rel="noopener noreferrer"&gt;cpp.ico&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;.cs&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ra101.github.io/namespace-ra/assets/cs.png" rel="noopener noreferrer"&gt;cs.png&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ra101.github.io/namespace-ra/assets/cs.ico" rel="noopener noreferrer"&gt;cs.ico&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;.h / .hpp&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ra101.github.io/namespace-ra/assets/h.png" rel="noopener noreferrer"&gt;h.png&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ra101.github.io/namespace-ra/assets/h.ico" rel="noopener noreferrer"&gt;h.ico&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;If you think I have missed something or you have other coding style or some advice, do let me know, I might append to this post. Make it one central point of all information.&lt;/p&gt;

</description>
      <category>c</category>
      <category>cpp</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>namespace ra :: BlockChain as STL, Data Structure and Iterators</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Tue, 22 Feb 2022 17:40:04 +0000</pubDate>
      <link>https://dev.to/ra101/namespace-ra-blockchain-as-stl-data-structure-and-iterators-2d0p</link>
      <guid>https://dev.to/ra101/namespace-ra-blockchain-as-stl-data-structure-and-iterators-2d0p</guid>
      <description>&lt;h3&gt;
  
  
  Aim:
&lt;/h3&gt;

&lt;p&gt;To create an &lt;u&gt;iterable&lt;/u&gt; blockchain, which could work with an &lt;u&gt;extendable&lt;/u&gt; transaction class. Here the link &lt;a href="https://github.com/ra101/Generic-BlockChain-container-cpp" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; repo!&lt;/p&gt;

&lt;h3&gt;
  
  
  Blockchain in Brief:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Blockchain is fundamentally a ledger maintaining records of transaction, This ledger is publicly distributed.&lt;/li&gt;
&lt;li&gt;Blockchain is a sort of linked-list of Blocks, A Block is a data-structure, that contains a set of transactions.&lt;/li&gt;
&lt;li&gt;Whenever a transaction happens, transferring party adds a reward for the "Miner".&lt;/li&gt;
&lt;li&gt;A "Miner" picks the set of transactions to be added in block till block-weight-limit (max allowed size of the block) is reached, then "Miner" does some heavy computation as proof of work and then sends the mined block in the world to add in each individual ledger. &lt;/li&gt;
&lt;li&gt;These Transactions need not be monetary but could be anything that you want to make immutable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Scope of this Project:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Will not be doing any server-side operations.&lt;/li&gt;
&lt;li&gt;Will create a data-structure complete with custom error and iterators.&lt;/li&gt;
&lt;li&gt;Miners reward will be sent out by the admin.&lt;/li&gt;
&lt;li&gt;No block-weight-limit.&lt;/li&gt;
&lt;li&gt;Our Own Custom Proof of Work. &lt;/li&gt;
&lt;li&gt;Extendable/Inheritable Transaction Class &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Plan of Attack:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;We are going to use &lt;a href="https://dev.to/ra101/namespace-ra-rsa-cryptography-45lb"&gt;RSA&lt;/a&gt; for our encryption needs.&lt;/li&gt;
&lt;li&gt;Extendable &lt;code&gt;base_transaction&lt;/code&gt; class.&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;block&lt;/code&gt; class with &lt;code&gt;Transaction&lt;/code&gt; and &lt;code&gt;HashFunction&lt;/code&gt; templates.&lt;/li&gt;
&lt;li&gt;Create a &lt;code&gt;blockchain&lt;/code&gt; class with the same templates and custom iterators to make it iterable.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Setup
&lt;/h4&gt;

&lt;p&gt;Lets Setup the extra files!&lt;/p&gt;

&lt;h5&gt;
  
  
  RSA: Library will be used for signing and verification of transactions.
&lt;/h5&gt;

&lt;blockquote&gt;
&lt;p&gt;Create a &lt;code&gt;includes&lt;/code&gt; folder and add files from &lt;a href="https://github.com/ra101/RSA-cpp" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;



&lt;h5&gt;
  
  
  &lt;code&gt;not_implemented_exception&lt;/code&gt;: The exception that is thrown when a requested method or operation is not implemented.
&lt;/h5&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;not_implemented_exception&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;logic_error&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
    &lt;span class="n"&gt;not_implemented_exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;__builtin_FUNCTION&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;logic_error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"`"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"` not implemented!"&lt;/span&gt;&lt;span class="p"&gt;){};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;base_transaction&amp;lt;EncryptionAlgo&amp;gt;&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;Here are the required things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parametric Constructor with &lt;code&gt;from_addr&lt;/code&gt;, &lt;code&gt;to_addr&lt;/code&gt;, &lt;code&gt;transfer_amount&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Hash Generator function (&lt;code&gt;generate_hash_input&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Override &lt;code&gt;string&lt;/code&gt; Operator (for string type casting)&lt;/li&gt;
&lt;li&gt;Override &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; Operator (for &lt;code&gt;cout&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Override &lt;code&gt;&amp;lt;&lt;/code&gt; Operator (for comparison)&lt;/li&gt;
&lt;li&gt;Function to get balance based on address (&lt;code&gt;get_balance(addr)&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Function to sign transaction (&lt;code&gt;sign_transaction(key_pair)&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Function to validate transaction (&lt;code&gt;is_transaction_valid(verifying_func)&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every Function logic will be same, which is to throw &lt;code&gt;not_implemented_exception&lt;/code&gt;, for example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;operator&lt;/span&gt; &lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;not_implemented_exception&lt;/span&gt;&lt;span class="p"&gt;();}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;custom_transaction : public base_transaction&amp;lt;EncryptionAlgo&amp;gt;&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;Private Members:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;from_address&lt;/code&gt; (Yours &lt;code&gt;public_key&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;to_address&lt;/code&gt; (Others &lt;code&gt;public_key&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;transfer_amount&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;timestamp&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;signature&lt;/code&gt; (Initially &lt;code&gt;0&lt;/code&gt;, will be updated in &lt;code&gt;sign_transaction&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Public Members:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parametric Constructor with &lt;code&gt;from_addr&lt;/code&gt;, &lt;code&gt;to_addr&lt;/code&gt;, &lt;code&gt;transfer_amount&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;custom_transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;from_adrr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;to_addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="n"&gt;from_address&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;from_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;to_address&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;to_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;transfer_amount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;chrono&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;steady_clock&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Hash Generator function (&lt;code&gt;generate_hash_input&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Concatenation of all stringified private variables (except Signature)
# to_string(...) in C++
&lt;/span&gt;&lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;from_addr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_addr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Override &lt;code&gt;string&lt;/code&gt; Operator (for string typecasting)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;operator&lt;/span&gt; &lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;from_address_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;from_address: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;from_address&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;to_address_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;to_address: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_address&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;transfer_amount_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;transfer_amount: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;transfer_amount&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;signature_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;signature: "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;from_address_str&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;to_address_str&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;transfer_amount_str&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;signature_str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Override &lt;code&gt;&amp;lt;&amp;lt;&lt;/code&gt; Operator (for &lt;code&gt;cout&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;friend&lt;/span&gt; &lt;span class="n"&gt;ostream&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;operator&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ostream&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;out&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;custom_transaction&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Using above string operator&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;out&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Override &lt;code&gt;&amp;lt;&lt;/code&gt; Operator (for comparison)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="k"&gt;operator&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;custom_transaction&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;generate_hash_input&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;other&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;generate_hash_input&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Function to get balance based on the address (&lt;code&gt;get_balance(addr)&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;get_balance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;to_address&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;transfer_amount&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;from_address&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;transfer_amount&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Function to sign transaction (&lt;code&gt;sign_transaction(key_pair)&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Here are some Pointers regarding signing&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Transaction is signed by the party making transaction therefore our &lt;code&gt;from_address&lt;/code&gt; should match &lt;code&gt;public_key&lt;/code&gt; in &lt;code&gt;key_pair&lt;/code&gt;. Let us create an Error Regarding that:&lt;/li&gt;
&lt;/ul&gt;


&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;public_key_mismatch&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;invalid_argument&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
    &lt;span class="n"&gt;public_key_mismatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;pk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;invalid_argument&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"from_addr: '"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;addr&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"' do not match public_key: '"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;pk&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"'"&lt;/span&gt;&lt;span class="p"&gt;){};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;A Transaction is can be signed once, Let us create a Exception Regarding that:&lt;/li&gt;
&lt;/ul&gt;


&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;resign_transaction_exception&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;logic_error&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;public:&lt;/span&gt;
    &lt;span class="n"&gt;resign_transaction_exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;logic_error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Resigning Transaction!"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;){};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;


&lt;ul&gt;
&lt;li&gt;Signing of Transaction refers Signing the stringified Transaction class i.e. output of &lt;code&gt;generate_hash_input()&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;template&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;typename&lt;/span&gt; &lt;span class="nc"&gt;EncryptionAlgo&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="nf"&gt;sign_transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;EncryptionAlgo&lt;/span&gt; &lt;span class="n"&gt;key_pair&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;from_address&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;key_pair&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_public_key&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;public_key_mismatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;from_address&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key_pair&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get_public_key&lt;/span&gt;&lt;span class="p"&gt;()));&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;signature&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// already signed&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;resign_transaction_exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="n"&gt;signature&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;key_pair&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;generate_hash_input&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Function to validate transaction (&lt;code&gt;is_transaction_valid(verifying_func)&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;is_transaction_valid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;verfication_function&lt;/span&gt;&lt;span class="p"&gt;)(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;size_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// reward, since reward is given by admin, there is no key pair&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;from_address&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;verfication_function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;generate_hash_input&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;signature&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;from_address&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;block &amp;lt;Transaction, HashFunctionClass&amp;gt;&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;NOTES:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;A block typically contains the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ID&lt;/li&gt;
&lt;li&gt;Previous Hash&lt;/li&gt;
&lt;li&gt;timestamp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;nonce&lt;/code&gt; ("number used once") a 32-bit, data computed in proof-of-work&lt;/li&gt;
&lt;li&gt;A set of Transactions (Merkel Tree) &lt;/li&gt;
&lt;li&gt;Hash (stringification of all of the above)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;code&gt;hash_function&lt;/code&gt; is an instance of template class used for all hashing related needs (&lt;code&gt;std::hash&lt;/code&gt; used in &lt;code&gt;main.cpp&lt;/code&gt;)&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Proof of Work:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calculating Hash in such a way that it becomes computationally intensive. A way to make it happen is:&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;

&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Here `nonce` is found via brute force
# until HASH_PATTERNis matched.
&lt;/span&gt;&lt;span class="nf"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;hash_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nonce&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;hash_function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hash_input&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;HASH_PATTERN&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;nonce&lt;/span&gt;
    &lt;span class="n"&gt;nonce&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;In &lt;strong&gt;BitCoin&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hash_function: &lt;code&gt;sha256&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;HASH_PATTERN: Starting with &lt;code&gt;n&lt;/code&gt; zeros, higher the &lt;code&gt;n&lt;/code&gt;, harder to compute.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;In &lt;code&gt;namespace::ra&lt;/code&gt; :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hash_function: Template (&lt;code&gt;std::hash&amp;lt;string&amp;gt;&lt;/code&gt; for reference)&lt;/li&gt;
&lt;li&gt;HASH_PATTERN: hash length must be &lt;code&gt;15/n&lt;/code&gt;, lesser the n, harder to compute.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;block_chain &amp;lt;Transaction, HashFunctionClass&amp;gt;&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;Well as the name states it is a chain of blocks, So Naturally, It will contain the same Template Arguments as &lt;code&gt;Block&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Private Members:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;list&amp;lt;BlockType&amp;gt; chain&lt;/code&gt; (A list of blocks)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;list&amp;lt;Trasaction&amp;gt; pending_transaction&lt;/code&gt; (Temperaroy Buffer before mining (&lt;em&gt;create a block and adding it to list&lt;/em&gt;))&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;difficulty&lt;/code&gt; (to be passed in &lt;code&gt;block&lt;/code&gt; class)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;minning_reward&lt;/code&gt; (If exists, will add a new transaction from admin before mining block)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;verfication_function&lt;/code&gt; (to verify block or transaction itself)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Public Members:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Iterator Class (To make iteration easy)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Private:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;std::_List_iterator&amp;lt;block_type&amp;gt;&lt;/code&gt; block_ptr, &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Public:

&lt;ul&gt;
&lt;li&gt;Override &lt;code&gt;==&lt;/code&gt;, &lt;code&gt;!=&lt;/code&gt;, &lt;code&gt;++&lt;/code&gt;, &lt;code&gt;&amp;amp;++&lt;/code&gt;, &lt;code&gt;--&lt;/code&gt;, &lt;code&gt;&amp;amp;--&lt;/code&gt;, for example:&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;iterator&lt;/span&gt; &lt;span class="k"&gt;operator&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;iterator&lt;/span&gt; &lt;span class="n"&gt;_temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;m_block_ptr&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;_temp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;


&lt;/blockquote&gt;
&lt;br&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Override the following to work with iterator class&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;

&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;iterator&lt;/span&gt; &lt;span class="nf"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;begin&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;iterator&lt;/span&gt; &lt;span class="nf"&gt;end&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;block_type&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;back&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;back&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;block_type&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;front&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;front&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;size&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;chain&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;block_chain(diffuculty, verfication_function, minning_reward)&lt;/code&gt; Constructor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update all the private variable by this constructor&lt;/li&gt;
&lt;li&gt;Add A Genesis Block to chain! &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;get_balance(): &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;float balance = 0&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Iterator over the &lt;code&gt;block_chai&lt;/code&gt;n from &lt;code&gt;begin()&lt;/code&gt; to &lt;code&gt;end()&lt;/code&gt; using iterator class and add it to &lt;code&gt;balance&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt; return &lt;code&gt;balance&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;code&gt;add_transaction(temp)&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;check &lt;code&gt;temp&lt;/code&gt; using &lt;code&gt;is_transaction_valid&lt;/code&gt; by passing in &lt;code&gt;verfication_function&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;add to &lt;code&gt;pending_transaction&lt;/code&gt; else Throw Error&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;code&gt;mine_pending_transactions(minning_reward_address)&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if &lt;code&gt;minning_reward&lt;/code&gt; exsits, add a reward &lt;code&gt;transaction&lt;/code&gt; to &lt;code&gt;minning_reward_address&lt;/code&gt;, else continue&lt;/li&gt;
&lt;li&gt;create a block with &lt;code&gt;pending_transaction&lt;/code&gt;, and push it to chain.&lt;/li&gt;
&lt;li&gt;clear &lt;code&gt;pending_transaction&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;code&gt;is_chain_valid()&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Iterator over the &lt;code&gt;chain&lt;/code&gt;, check the validity of current block using &lt;code&gt;is_block_valid&lt;/code&gt; by passing in &lt;code&gt;verfication_function&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;check if &lt;code&gt;previous_hash&lt;/code&gt; of current block matches &lt;code&gt;hash&lt;/code&gt; of the previous block&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;All the code can be found at the below link:&lt;br&gt;
&lt;a href="https://github.com/ra101/Generic-BlockChain-container-cpp" rel="noopener noreferrer"&gt;https://github.com/ra101/Generic-BlockChain-container-cpp&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>opensource</category>
      <category>showdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>namespace ra :: RSA Cryptography</title>
      <dc:creator>Parth Agarwal</dc:creator>
      <pubDate>Fri, 28 Jan 2022 14:10:59 +0000</pubDate>
      <link>https://dev.to/ra101/namespace-ra-rsa-cryptography-45lb</link>
      <guid>https://dev.to/ra101/namespace-ra-rsa-cryptography-45lb</guid>
      <description>&lt;h3&gt;
  
  
  Aim:
&lt;/h3&gt;

&lt;p&gt;To create a working RSA code, Using &lt;a href="https://dev.to/ra101/namespace-ra-random-prime-no-generator-2d8d"&gt;&lt;code&gt;namespace ra::random_prime_engine&lt;/code&gt;&lt;/a&gt;, Here the link &lt;a href="https://github.com/ra101/RSA-cpp" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; repo!&lt;/p&gt;

&lt;h3&gt;
  
  
  What is RSA?
&lt;/h3&gt;

&lt;p&gt;The Rivest-Shamir-Adleman (RSA) is an asymmetric encryption algorithm. Asymmetric Encryption is when a box(data) can be locked by one key and unlocked by other. locking key cannot unlock the box and vice-versa. The locking key is the public key and the unlocking key is the private key, Public key is called so because we publicly distribute it, so anyone/everyone would send the user an encrypted msg, and the user can unlock it in private with the private key.&lt;br&gt;
By keeping private to the user-self, no hacker can get a method of unlocking it.&lt;/p&gt;
&lt;h4&gt;
  
  
  How RSA Works?
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://ra101.hashnode.dev/rsa-encryption-algorithm" rel="noopener noreferrer"&gt;https://ra101.hashnode.dev/rsa-encryption-algorithm&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Code:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Private Members:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;private_key&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;public_key&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;create_key(long seed)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Public Members:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Constructor&lt;/code&gt; &amp;amp; &lt;code&gt;Constructor(seed)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;std::size_t decrypt(std::size_t);&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;std::size_t decrypt_with_padding(std::string);&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Key Getters&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;std::size_t sign(Message message)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Other Function within &lt;code&gt;namespace&lt;/code&gt; but Outside &lt;code&gt;class&lt;/code&gt; &lt;em&gt;(All the functions utilizing public key)&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;std::size_t encrypt(std::size_t digest, public_key);&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;std::string encrypt_with_padding(std::size_t digest, public_key);&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bool verify(Message message, size_t digest, public_key)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;string padding(string)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Constructors:
&lt;/h4&gt;

&lt;p&gt;The seed in the constructor is used in &lt;code&gt;random prime engine&lt;/code&gt; and the logic of the seed argument is as follow,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# pseudo code implemented in python
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seed&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;create_key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Usage&lt;/span&gt;

&lt;span class="n"&gt;ra&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;rsa_key_pair&lt;/span&gt; &lt;span class="n"&gt;k1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"127.0.0.1"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;create_key(seed)&lt;/code&gt; function,
&lt;/h4&gt;

&lt;p&gt;I will not get into the mathematics of it all, but in the end, using 2 primary numbers we get&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;public key: (n, e)&lt;/li&gt;
&lt;li&gt;private key: (n, d)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(n, e, d) all are integers.&lt;/p&gt;

&lt;p&gt;To concatenate these two numbers (n, e/d) let us define a big number &lt;code&gt;BIG_NO&lt;/code&gt;, such that &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;n = key / BIG_NO&lt;/li&gt;
&lt;li&gt;e = public_key % BIG_NO&lt;/li&gt;
&lt;li&gt;d = private_key % BIG_NO
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define BIG_NO 100000000000
&lt;/span&gt;
&lt;span class="n"&gt;public_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;BIG_NO&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;private_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;BIG_NO&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;encrypt(digest, key)&lt;/code&gt; function,
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;digest&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;decrypt(encrypted_data)&lt;/code&gt; function,
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;encrypted_data&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;padding(string str)&lt;/code&gt; function,
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define PAD_SIZE 10
&lt;/span&gt;
&lt;span class="c1"&gt;// 12345 -&amp;gt; 0000012345&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;PAD_SIZE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sc"&gt;'0'&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// add 0 in front of no.&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;encrypt_with_padding(digest, key)&lt;/code&gt; function,
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# encrypt each digit
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;each_digit&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;encrypt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;each_digit&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;decrypt_with_padding(encrypted_data)&lt;/code&gt; function,
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# cut the input string in chunks of length PAD_SIZE
# decrypt each chunk to digit and then form a output
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i_chunk&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;encrypted_data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;PAD_SIZE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i_chunk&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;PAD_SIZE&lt;/span&gt;
    &lt;span class="n"&gt;digit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;decrypt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;encrypted_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;PAD_SIZE&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;digit&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;sign(Message message)&lt;/code&gt; function,
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;decrypt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;code&gt;verify(Message message, digest, others_public_key)&lt;/code&gt; function,
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nf"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nf"&gt;encrypt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;others_public_key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All the code can be found at the below link: &lt;a href="https://github.com/ra101/RSA-cpp" rel="noopener noreferrer"&gt;https://github.com/ra101/RSA-cpp&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>opensource</category>
      <category>showdev</category>
      <category>crypto</category>
    </item>
  </channel>
</rss>
