create account

[repost to inform more people about it] An open source data encryption software for steemit users by royalmacro

View this thread on: hive.blogpeakd.comecency.com
· @royalmacro ·
$0.99
[repost to inform more people about it] An open source data encryption software for steemit users
<html>
<p>I repost this article only for informing more people about this software I made.</p>
<p>This encryption tool was developed in Visual Basic 8. This software is to be used &nbsp;for encrypting any text data. As we know on Steemit Platform we need a very long passphrase to be used. And also &nbsp;POSTING , &nbsp;ACTIVE , &nbsp;OWNER &amp; &nbsp;MEMO private key are very long. &nbsp;It’s impossible to memorize this passphrases. So, what can we do ? Maximum users saved the data without encrypting it in their note pads, which is very dangerous. If hackers or, anyone get this data then he will gain access our accounts &amp; for a result all accounts shall be compromised.&nbsp;</p>
<p>So, encryption is very important. Encrypted data can be saved everywhere &amp; also be shared with anyone without any risk. I know there are a lot of free password keepers &amp; encryption programs exist. But, maximum are not open source programs.&nbsp;</p>
<p>&nbsp;My main objective is to provide such type open-source program. You may also learn how to develop an encryption tool.</p>
<p><br></p>
<p>I use <a href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard">AES Rijndael Block Cipher Encryption Algorithm</a> to encrypt text data.</p>

<p><strong>Step by Step Development :</strong></p>

<p>Open a new project in Visual Basic 8. Select “Standard EXE”.</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/VB1c3f0e.jpg" alt="enter image description here" title=""></p>

<p><img src="https://www.steemimg.com/images/2016/09/16/VB2ce10f.jpg" alt="enter image description here" title=""></p>

<p>Create two text boxes &amp; two command buttons on the form. Text1 textbox, Text2 textbox, Command1 commandbutton &amp; Command2 commandbutton.</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb386e21.jpg" alt="enter image description here" title=""></p>

<p>Change the caption of the command buttons from “Command1” to “Encrypt data” &amp; “Command2” to “Decrypt data”.</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb454e00.jpg" alt="enter image description here" title=""></p>

<p>Add a class module “CRijndael” to the project </p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb5532df.jpg" alt="enter image description here" title=""></p>

<p>Add this following codes to the class module “CRijndael” :</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb66bb27.jpg" alt="enter image description here" title=""></p>

<p></p>

<blockquote>
  <p><em>'  Credits :      Phil Fresle</em> <br><br>
Option Explicit <br>
  Private m_lOnBits(30)    As Long <br>
  Private m_l2Power(30)    As Long <br>
  Private m_bytOnBits(7)   As Byte <br>
  Private m_byt2Power(7)   As Byte <br>
  Private m_InCo(3)        As Byte <br>
  Private m_fbsub(255)     As Byte <br>
  Private m_rbsub(255)     As Byte <br>
  Private m_ptab(255)      As Byte <br>
  Private m_ltab(255)      As Byte <br>
  Private m_ftable(255)    As Long <br>
  Private m_rtable(255)    As Long <br>
  Private m_rco(29)        As Long <br>
  Private m_Nk             As Long <br>
  Private m_Nb             As Long <br>
  Private m_Nr             As Long <br>
  Private m_fi(23)         As Byte <br>
  Private m_ri(23)         As Byte <br>
  Private m_fkey(119)      As Long <br>
  Private m_rkey(119)      As Long <br>
  Private Declare Sub CopyMemory Lib “kernel32” Alias “RtlMoveMemory” (ByVal Destination As Any, ByVal Source As Any, ByVal Length As Long) <br>
  Private Sub Class_Initialize() <br>
      m_InCo(0) = &amp;HB:    m_InCo(1) = &amp;HD <br>
      m_InCo(2) = &amp;H9:    m_InCo(3) = &amp;HE <br>
      m_bytOnBits(0) = 1          ’ 00000001 <br>
      m_bytOnBits(1) = 3          ’ 00000011 <br>
      m_bytOnBits(2) = 7          ’ 00000111 <br>
      m_bytOnBits(3) = 15         ’ 00001111 <br>
      m_bytOnBits(4) = 31         ’ 00011111 <br>
      m_bytOnBits(5) = 63         ’ 00111111 <br>
      m_bytOnBits(6) = 127        ’ 01111111 <br>
      m_bytOnBits(7) = 255        ’ 11111111 <br>
      m_byt2Power(0) = 1          ’ 00000001 <br>
      m_byt2Power(1) = 2          ’ 00000010 <br>
      m_byt2Power(2) = 4          ’ 00000100 <br>
      m_byt2Power(3) = 8          ’ 00001000 <br>
      m_byt2Power(4) = 16         ’ 00010000 <br>
      m_byt2Power(5) = 32         ’ 00100000 <br>
      m_byt2Power(6) = 64         ’ 01000000 <br>
      m_byt2Power(7) = 128        ’ 10000000 <br>
      m_lOnBits(0) = 1            ’ 00000000000000000000000000000001 <br>
      m_lOnBits(1) = 3            ’ 00000000000000000000000000000011 <br>
      m_lOnBits(2) = 7            ’ 00000000000000000000000000000111 <br>
      m_lOnBits(3) = 15           ’ 00000000000000000000000000001111 <br>
      m_lOnBits(4) = 31           ’ 00000000000000000000000000011111 <br>
      m_lOnBits(5) = 63           ’ 00000000000000000000000000111111 <br>
      m_lOnBits(6) = 127          ’ 00000000000000000000000001111111 <br>
      m_lOnBits(7) = 255          ’ 00000000000000000000000011111111 <br>
      m_lOnBits(8) = 511          ’ 00000000000000000000000111111111 <br>
      m_lOnBits(9) = 1023         ’ 00000000000000000000001111111111 <br>
      m_lOnBits(10) = 2047        ’ 00000000000000000000011111111111 <br>
      m_lOnBits(11) = 4095        ’ 00000000000000000000111111111111 <br>
      m_lOnBits(12) = 8191        ’ 00000000000000000001111111111111 <br>
      m_lOnBits(13) = 16383       ’ 00000000000000000011111111111111 <br>
      m_lOnBits(14) = 32767       ’ 00000000000000000111111111111111 <br>
      m_lOnBits(15) = 65535       ’ 00000000000000001111111111111111 <br>
      m_lOnBits(16) = 131071      ’ 00000000000000011111111111111111 <br>
      m_lOnBits(17) = 262143      ’ 00000000000000111111111111111111 <br>
      m_lOnBits(18) = 524287      ’ 00000000000001111111111111111111 <br>
      m_lOnBits(19) = 1048575     ’ 00000000000011111111111111111111 <br>
      m_lOnBits(20) = 2097151     ’ 00000000000111111111111111111111 <br>
      m_lOnBits(21) = 4194303     ’ 00000000001111111111111111111111 <br>
      m_lOnBits(22) = 8388607     ’ 00000000011111111111111111111111 <br>
      m_lOnBits(23) = 16777215    ’ 00000000111111111111111111111111 <br>
      m_lOnBits(24) = 33554431    ’ 00000001111111111111111111111111 <br>
      m_lOnBits(25) = 67108863    ’ 00000011111111111111111111111111 <br>
      m_lOnBits(26) = 134217727   ’ 00000111111111111111111111111111 <br>
      m_lOnBits(27) = 268435455   ’ 00001111111111111111111111111111 <br>
      m_lOnBits(28) = 536870911   ’ 00011111111111111111111111111111 <br>
      m_lOnBits(29) = 1073741823  ’ 00111111111111111111111111111111 <br>
      m_lOnBits(30) = 2147483647  ’ 01111111111111111111111111111111 <br>
      m_l2Power(0) = 1            ’ 00000000000000000000000000000001 <br>
      m_l2Power(1) = 2            ’ 00000000000000000000000000000010 <br>
      m_l2Power(2) = 4            ’ 00000000000000000000000000000100 <br>
      m_l2Power(3) = 8            ’ 00000000000000000000000000001000 <br>
      m_l2Power(4) = 16           ’ 00000000000000000000000000010000 <br>
      m_l2Power(5) = 32           ’ 00000000000000000000000000100000 <br>
      m_l2Power(6) = 64           ’ 00000000000000000000000001000000 <br>
      m_l2Power(7) = 128          ’ 00000000000000000000000010000000 <br>
      m_l2Power(8) = 256          ’ 00000000000000000000000100000000 <br>
      m_l2Power(9) = 512          ’ 00000000000000000000001000000000 <br>
      m_l2Power(10) = 1024        ’ 00000000000000000000010000000000 <br>
      m_l2Power(11) = 2048        ’ 00000000000000000000100000000000 <br>
      m_l2Power(12) = 4096        ’ 00000000000000000001000000000000 <br>
      m_l2Power(13) = 8192        ’ 00000000000000000010000000000000 <br>
      m_l2Power(14) = 16384       ’ 00000000000000000100000000000000 <br>
      m_l2Power(15) = 32768       ’ 00000000000000001000000000000000 <br>
      m_l2Power(16) = 65536       ’ 00000000000000010000000000000000 <br>
      m_l2Power(17) = 131072      ’ 00000000000000100000000000000000 <br>
      m_l2Power(18) = 262144      ’ 00000000000001000000000000000000 <br>
      m_l2Power(19) = 524288      ’ 00000000000010000000000000000000 <br>
      m_l2Power(20) = 1048576     ’ 00000000000100000000000000000000 <br>
      m_l2Power(21) = 2097152     ’ 00000000001000000000000000000000 <br>
      m_l2Power(22) = 4194304     ’ 00000000010000000000000000000000 <br>
      m_l2Power(23) = 8388608     ’ 00000000100000000000000000000000 <br>
      m_l2Power(24) = 16777216    ’ 00000001000000000000000000000000 <br>
      m_l2Power(25) = 33554432    ’ 00000010000000000000000000000000 <br>
      m_l2Power(26) = 67108864    ’ 00000100000000000000000000000000 <br>
      m_l2Power(27) = 134217728   ’ 00001000000000000000000000000000 <br>
      m_l2Power(28) = 268435456   ’ 00010000000000000000000000000000 <br>
      m_l2Power(29) = 536870912   ’ 00100000000000000000000000000000 <br>
      m_l2Power(30) = 1073741824  ’ 01000000000000000000000000000000 <br>
  End Sub <br>
  Private Function LShift(ByVal lValue As Long, ByVal iShiftBits As Integer) As Long <br>
      If iShiftBits = 0 Then <br>
          LShift = lValue:        Exit Function <br>
      ElseIf iShiftBits = 31 Then <br>
          LShift = IIf(lValue And 1, &amp;H80000000, 0) <br>
          Exit Function <br>
      ElseIf iShiftBits &lt; 0 Or iShiftBits &gt; 31 Then <br>
          Err.Raise 6 <br>
      End If <br>
      If (lValue And m_l2Power(31 - iShiftBits)) Then <br>
          LShift = ((lValue And m_lOnBits(31 - (iShiftBits + 1))) * m_l2Power(iShiftBits)) Or &amp;H80000000 <br>
      Else <br>
          LShift = ((lValue And m_lOnBits(31 - iShiftBits)) * m_l2Power(iShiftBits)) <br>
      End If <br>
  End Function <br>
  Private Function RShift(ByVal lValue As Long, ByVal iShiftBits As Integer) As Long <br>
      If iShiftBits = 0 Then <br>
          RShift = lValue:        Exit Function <br>
      ElseIf iShiftBits = 31 Then <br>
          RShift = IIf(lValue And &amp;H80000000, 1, 0) <br>
          Exit Function <br>
      ElseIf iShiftBits &lt; 0 Or iShiftBits &gt; 31 Then <br>
          Err.Raise 6 <br>
      End If <br>
      RShift = (lValue And &amp;H7FFFFFFE) \ m_l2Power(iShiftBits) <br>
      If (lValue And &amp;H80000000) Then RShift = (RShift Or (&amp;H40000000 \ m_l2Power(iShiftBits - 1))) <br>
  End Function <br>
  Private Function LShiftByte(ByVal bytValue As Byte, ByVal bytShiftBits As Byte) As Byte <br>
      If bytShiftBits = 0 Then <br>
          LShiftByte = bytValue:        Exit Function <br>
      ElseIf bytShiftBits = 7 Then <br>
          LShiftByte = IIf(bytValue And 1, &amp;H80, 0) <br>
          Exit Function <br>
      ElseIf bytShiftBits &lt; 0 Or bytShiftBits &gt; 7 Then <br>
          Err.Raise 6 <br>
      End If <br>
      LShiftByte = ((bytValue And m_bytOnBits(7 - bytShiftBits)) * m_byt2Power(bytShiftBits)) <br>
  End Function <br>
  Private Function RShiftByte(ByVal bytValue As Byte, ByVal bytShiftBits As Byte) As Byte <br>
      If bytShiftBits = 0 Then <br>
          RShiftByte = bytValue:        Exit Function <br>
      ElseIf bytShiftBits = 7 Then <br>
          RShiftByte = IIf(bytValue And &amp;H80, 1, 0) <br>
          Exit Function <br>
      ElseIf bytShiftBits &lt; 0 Or bytShiftBits &gt; 7 Then <br>
          Err.Raise 6 <br>
      End If <br>
      RShiftByte = bytValue \ m_byt2Power(bytShiftBits) <br>
  End Function <br>
  Private Function RotateLeft(ByVal lValue As Long, ByVal iShiftBits As Integer) As Long <br>
      RotateLeft = LShift(lValue, iShiftBits) Or RShift(lValue, (32 - iShiftBits)) <br>
  End Function <br>
  Private Function RotateLeftByte(ByVal bytValue As Byte, ByVal bytShiftBits As Byte) As Byte <br>
      RotateLeftByte = LShiftByte(bytValue, bytShiftBits) Or RShiftByte(bytValue, (8 - bytShiftBits)) <br>
  End Function <br>
  Private Function Pack(b() As Byte) As Long <br>
  Dim lCount As Long, lTemp  As Long <br>
      For lCount = 0 To 3 <br>
          lTemp = b(lCount): Pack = Pack Or LShift(lTemp, (lCount * 8)) <br>
      Next lCount <br>
  End Function <br>
  Private Function PackFrom(b() As Byte, ByVal k As Long) As Long <br>
  Dim lCount As Long, lTemp  As Long <br>
      For lCount = 0 To 3 <br>
          lTemp = b(lCount + k): PackFrom = PackFrom Or LShift(lTemp, (lCount * 8)) <br>
      Next lCount <br>
  End Function <br>
  Private Sub Unpack(ByVal a As Long, b() As Byte) <br>
      b(0) = a And m_lOnBits(7) <br>
      b(1) = RShift(a, 8) And m_lOnBits(7) <br>
      b(2) = RShift(a, 16) And m_lOnBits(7) <br>
      b(3) = RShift(a, 24) And m_lOnBits(7) <br>
  End Sub <br>
  Private Sub UnpackFrom(ByVal a As Long, b() As Byte, ByVal k As Long) <br>
      b(0 + k) = a And m_lOnBits(7) <br>
      b(1 + k) = RShift(a, 8) And m_lOnBits(7) <br>
      b(2 + k) = RShift(a, 16) And m_lOnBits(7) <br>
      b(3 + k) = RShift(a, 24) And m_lOnBits(7) <br>
  End Sub <br>
  Private Function Xtime(ByVal a As Byte) As Byte <br>
  Dim b As Byte:    b = IIf(a And &amp;H80, &amp;H1B, 0) <br>
      a = LShiftByte(a, 1):   a = a Xor b:   Xtime = a <br>
  End Function <br>
  Private Function Bmul(ByVal x As Byte, y As Byte) As Byte <br>
      If x &lt;&gt; 0 And y &lt;&gt; 0 Then <br>
          Bmul = m_ptab((CLng(m_ltab(x)) + CLng(m_ltab(y))) Mod 255) <br>
      Else <br>
          Bmul = 0 <br>
      End If <br>
  End Function <br>
  Private Function SubByte(ByVal a As Long) As Long <br>
  Dim b(3) As Byte <br>
      Unpack a, b <br>
      b(0) = m_fbsub(b(0)):    b(1) = m_fbsub(b(1)) <br>
      b(2) = m_fbsub(b(2)):    b(3) = m_fbsub(b(3)) <br>
      SubByte = Pack(b) <br>
  End Function <br>
  Private Function Product(ByVal x As Long, ByVal y As Long) As Long <br>
  Dim xb(3) As Byte, yb(3) As Byte <br>
      Unpack x, xb:    Unpack y, yb <br>
      Product = Bmul(xb(0), yb(0)) Xor Bmul(xb(1), yb(1)) Xor Bmul(xb(2), yb(2)) Xor Bmul(xb(3), yb(3)) <br>
  End Function <br>
  Private Function InvMixCol(ByVal x As Long) As Long <br>
  Dim y       As Long, m       As Long, b(3)    As Byte <br>
      m = Pack(m_InCo) <br>
      b(3) = Product(m, x):    m = RotateLeft(m, 24) <br>
      b(2) = Product(m, x):    m = RotateLeft(m, 24) <br>
      b(1) = Product(m, x):    m = RotateLeft(m, 24) <br>
      b(0) = Product(m, x):    y = Pack(b) <br>
      InvMixCol = y <br>
  End Function <br>
  Private Function ByteSub(ByVal x As Byte) As Byte <br>
  Dim y As Byte <br>
      y = m_ptab(255 - m_ltab(x)):    x = y <br>
      x = RotateLeftByte(x, 1):       y = y Xor x <br>
      x = RotateLeftByte(x, 1):       y = y Xor x <br>
      x = RotateLeftByte(x, 1):       y = y Xor x <br>
      x = RotateLeftByte(x, 1):       y = y Xor x <br>
      y = y Xor &amp;H63:              ByteSub = y <br>
  End Function <br>
  Private Sub gentables() <br>
  Dim i    As Long, y As Byte <br>
  Dim b(3) As Byte, ib As Byte <br>
      m_ltab(0) = 0:    m_ptab(0) = 1 <br>
      m_ltab(1) = 0:    m_ptab(1) = 3 <br>
      m_ltab(3) = 1 <br>
      For i = 2 To 255 <br>
          m_ptab(i) = m_ptab(i - 1) Xor Xtime(m_ptab(i - 1)) <br>
          m_ltab(m_ptab(i)) = i <br>
      Next i <br>
      m_fbsub(0) = &amp;H63:    m_rbsub(&amp;H63) = 0 <br>
      For i = 1 To 255 <br>
          ib = i:        y = ByteSub(ib) <br>
          m_fbsub(i) = y:        m_rbsub(y) = i <br>
      Next i <br>
      y = 1 <br>
      For i = 0 To 29 <br>
          m_rco(i) = y:        y = Xtime(y) <br>
      Next i <br>
      For i = 0 To 255 <br>
          y = m_fbsub(i):        b(3) = y Xor Xtime(y) <br>
          b(2) = y:               b(1) = y <br>
          b(0) = Xtime(y):        m_ftable(i) = Pack(b) <br>
          y = m_rbsub(i):        b(3) = Bmul(m_InCo(0), y) <br>
          b(2) = Bmul(m_InCo(1), y): b(1) = Bmul(m_InCo(2), y) <br>
          b(0) = Bmul(m_InCo(3), y): m_rtable(i) = Pack(b) <br>
      Next i <br>
  End Sub <br>
  Private Sub gkey(ByVal nb As Long, ByVal nk As Long, Key() As Byte) <br>
  Dim i            As Long, j As Long, k As Long, m As Long <br>
  Dim N            As Long, C1 As Long, C2 As Long, C3 As Long <br>
  Dim CipherKey(7) As Long <br>
      m_Nb = nb:    m_Nk = nk <br>
      If m_Nb &gt;= m_Nk Then <br>
          m_Nr = 6 + m_Nb <br>
      Else <br>
          m_Nr = 6 + m_Nk <br>
      End If <br>
      C1 = 1 <br>
      If m_Nb &lt; 8 Then <br>
          C2 = 2:        C3 = 3 <br>
      Else <br>
          C2 = 3:        C3 = 4 <br>
      End If <br>
      For j = 0 To nb - 1 <br>
          m = j * 3 <br>
          m_fi(m) = (j + C1) Mod nb <br>
          m_fi(m + 1) = (j + C2) Mod nb <br>
          m_fi(m + 2) = (j + C3) Mod nb <br>
          m_ri(m) = (nb + j - C1) Mod nb <br>
          m_ri(m + 1) = (nb + j - C2) Mod nb <br>
          m_ri(m + 2) = (nb + j - C3) Mod nb <br>
      Next j <br>
      N = m_Nb * (m_Nr + 1) <br>
      For i = 0 To m_Nk - 1 <br>
          j = i * 4:        CipherKey(i) = PackFrom(Key, j) <br>
      Next i <br>
      For i = 0 To m_Nk - 1 <br>
          m_fkey(i) = CipherKey(i) <br>
      Next i <br>
      j = m_Nk:    k = 0 <br>
      Do While j &lt; N <br>
          m_fkey(j) = m_fkey(j - m_Nk) Xor SubByte(RotateLeft(m_fkey(j - 1), 24)) Xor m_rco(k) <br>
          If m_Nk &lt;= 6 Then <br>
              i = 1 <br>
              Do While i &lt; m_Nk And (i + j) &lt; N <br>
                  m_fkey(i + j) = m_fkey(i + j - m_Nk) Xor m_fkey(i + j - 1): i = i + 1 <br>
              Loop <br>
          Else <br>
              i = 1 <br>
              Do While i &lt; 4 And (i + j) &lt; N <br>
                  m_fkey(i + j) = m_fkey(i + j - m_Nk) Xor m_fkey(i + j - 1): i = i + 1 <br>
              Loop <br>
              If j + 4 &lt; N Then <br>
                  m_fkey(j + 4) = m_fkey(j + 4 - m_Nk) Xor SubByte(m_fkey(j + 3)) <br>
              End If <br>
              i = 5 <br>
              Do While i &lt; m_Nk And (i + j) &lt; N <br>
                  m_fkey(i + j) = m_fkey(i + j - m_Nk) Xor m_fkey(i + j - 1): i = i + 1 <br>
              Loop <br>
          End If <br>
          j = j + m_Nk:        k = k + 1 <br>
      Loop <br>
      For j = 0 To m_Nb - 1 <br>
          m_rkey(j + N - nb) = m_fkey(j) <br>
      Next j <br>
      i = m_Nb <br>
      Do While i &lt; N - m_Nb <br>
          k = N - m_Nb - i <br>
          For j = 0 To m_Nb - 1 <br>
              m_rkey(k + j) = InvMixCol(m_fkey(i + j)) <br>
          Next j <br>
          i = i + m_Nb <br>
      Loop <br>
      j = N - m_Nb <br>
      Do While j &lt; N <br>
          m_rkey(j - N + m_Nb) = m_fkey(j):        j = j + 1 <br>
      Loop <br>
  End Sub <br>
  Private Sub Encrypt(Buff() As Byte) <br>
  Dim i    As Long, j As Long, k As Long, m As Long <br>
  Dim a(7) As Long, b(7) As Long, x() As Long <br>
  Dim y()  As Long, t() As Long <br>
      For i = 0 To m_Nb - 1 <br>
          j = i * 4: a(i) = PackFrom(Buff, j): a(i) = a(i) Xor m_fkey(i) <br>
      Next i <br>
      k = m_Nb:    x = a:    y = b <br>
      For i = 1 To m_Nr - 1 <br>
          For j = 0 To m_Nb - 1 <br>
              m = j * 3 <br>
              y(j) = m_fkey(k) Xor m_ftable(x(j) And m_lOnBits(7)) Xor RotateLeft(m_ftable(RShift(x(m_fi(m)), 8) And m_lOnBits(7)), 8) Xor RotateLeft(m_ftable(RShift(x(m_fi(m + 1)), 16) And m_lOnBits(7)), 16) Xor RotateLeft(m_ftable(RShift(x(m_fi(m + 2)), 24) And m_lOnBits(7)), 24) <br>
              k = k + 1 <br>
          Next j <br>
          t = x:        x = y:        y = t <br>
      Next i <br>
      For j = 0 To m_Nb - 1 <br>
          m = j * 3 <br>
          y(j) = m_fkey(k) Xor m_fbsub(x(j) And m_lOnBits(7)) Xor RotateLeft(m_fbsub(RShift(x(m_fi(m)), 8) And m_lOnBits(7)), 8) Xor RotateLeft(m_fbsub(RShift(x(m_fi(m + 1)), 16) And m_lOnBits(7)), 16) Xor RotateLeft(m_fbsub(RShift(x(m_fi(m + 2)), 24) And m_lOnBits(7)), 24) <br>
          k = k + 1 <br>
      Next j <br>
      For i = 0 To m_Nb - 1 <br>
          j = i * 4: UnpackFrom y(i), Buff, j: x(i) = 0: y(i) = 0 <br>
      Next i <br>
  End Sub <br>
  Private Sub Decrypt(Buff() As Byte) <br>
  Dim i    As Long, j As Long, k As Long, m As Long <br>
  Dim a(7) As Long, b(7) As Long, x() As Long <br>
  Dim y()  As Long, t() As Long <br>
      For i = 0 To m_Nb - 1 <br>
          j = i * 4: a(i) = PackFrom(Buff, j): a(i) = a(i) Xor m_rkey(i) <br>
      Next i <br>
      k = m_Nb:    x = a:    y = b <br>
      For i = 1 To m_Nr - 1 <br>
          For j = 0 To m_Nb - 1 <br>
              m = j * 3 <br>
              y(j) = m_rkey(k) Xor m_rtable(x(j) And m_lOnBits(7)) Xor RotateLeft(m_rtable(RShift(x(m_ri(m)), 8) And m_lOnBits(7)), 8) Xor RotateLeft(m_rtable(RShift(x(m_ri(m + 1)), 16) And m_lOnBits(7)), 16) Xor RotateLeft(m_rtable(RShift(x(m_ri(m + 2)), 24) And m_lOnBits(7)), 24) <br>
              k = k + 1 <br>
          Next j <br>
          t = x:        x = y:        y = t <br>
      Next i <br>
      For j = 0 To m_Nb - 1 <br>
          m = j * 3 <br>
          y(j) = m_rkey(k) Xor m_rbsub(x(j) And m_lOnBits(7)) Xor RotateLeft(m_rbsub(RShift(x(m_ri(m)), 8) And m_lOnBits(7)), 8) Xor RotateLeft(m_rbsub(RShift(x(m_ri(m + 1)), 16) And m_lOnBits(7)), 16) Xor RotateLeft(m_rbsub(RShift(x(m_ri(m + 2)), 24) And m_lOnBits(7)), 24) <br>
          k = k + 1 <br>
      Next j <br>
      For i = 0 To m_Nb - 1 <br>
          j = i * 4: UnpackFrom y(i), Buff, j: x(i) = 0: y(i) = 0 <br>
      Next i <br>
  End Sub <br>
  Private Function IsInitialized(ByRef vArray As Variant) As Boolean <br>
      On Local Error Resume Next <br>
      IsInitialized = IsNumeric(UBound(vArray)) <br>
  End Function <br>
  Public Function EncryptData(bytMessage() As Byte, bytPassword() As Byte) As Byte() <br>
  Dim bytKey(31)     As Byte, bytIn() As Byte, bytOut() As Byte <br>
  Dim bytTemp(31)    As Byte, lCount As Long, lLength As Long <br>
  Dim lEncodedLength As Long, bytLen(3) As Byte, lPosition As Long <br>
      If Not IsInitialized(bytMessage) Then Exit Function <br>
      If Not IsInitialized(bytPassword) Then Exit Function <br>
      For lCount = 0 To UBound(bytPassword) <br>
          bytKey(lCount) = bytPassword(lCount): If lCount = 31 Then Exit For <br>
      Next lCount <br>
      gentables <br>
      gkey 8, 8, bytKey <br>
      lLength = UBound(bytMessage) + 1:    lEncodedLength = lLength + 4 <br>
      If lEncodedLength Mod 32 &lt;&gt; 0 Then lEncodedLength = lEncodedLength + 32 - (lEncodedLength Mod 32) <br>
      ReDim bytIn(lEncodedLength - 1):    ReDim bytOut(lEncodedLength - 1) <br>
      CopyMemory VarPtr(bytIn(0)), VarPtr(lLength), 4 <br>
      CopyMemory VarPtr(bytIn(4)), VarPtr(bytMessage(0)), lLength <br>
      For lCount = 0 To lEncodedLength - 1 Step 32 <br>
          CopyMemory VarPtr(bytTemp(0)), VarPtr(bytIn(lCount)), 32 <br>
          Encrypt bytTemp <br>
          CopyMemory VarPtr(bytOut(lCount)), VarPtr(bytTemp(0)), 32 <br>
      Next lCount <br>
      EncryptData = bytOut <br>
  End Function <br>
  Public Function DecryptData(bytIn() As Byte, bytPassword() As Byte) As Byte() <br>
  Dim bytMessage()   As Byte, bytKey(31) As Byte, bytOut() As Byte <br>
  Dim bytTemp(31)    As Byte, lCount As Long, lLength As Long <br>
  Dim lEncodedLength As Long, bytLen(3) As Byte, lPosition As Long <br>
      If Not IsInitialized(bytIn) Then Exit Function <br>
      If Not IsInitialized(bytPassword) Then Exit Function <br>
      lEncodedLength = UBound(bytIn) + 1 <br>
      If lEncodedLength Mod 32 &lt;&gt; 0 Then Exit Function <br>
      For lCount = 0 To UBound(bytPassword) <br>
          bytKey(lCount) = bytPassword(lCount):  If lCount = 31 Then Exit For <br>
      Next lCount <br>
      gentables <br>
      gkey 8, 8, bytKey <br>
      ReDim bytOut(lEncodedLength - 1) <br>
      For lCount = 0 To lEncodedLength - 1 Step 32 <br>
          CopyMemory VarPtr(bytTemp(0)), VarPtr(bytIn(lCount)), 32 <br>
          Decrypt bytTemp <br>
          CopyMemory VarPtr(bytOut(lCount)), VarPtr(bytTemp(0)), 32 <br>
      Next lCount <br>
      CopyMemory VarPtr(lLength), VarPtr(bytOut(0)), 4 <br>
      If lLength &gt; lEncodedLength - 4 Then Exit Function <br>
      ReDim bytMessage(lLength - 1) <br>
      CopyMemory VarPtr(bytMessage(0)), VarPtr(bytOut(4)), lLength <br>
      DecryptData = bytMessage <br>
  End Function</p>
</blockquote>

<p>Add a module “Module 1” to the project</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb703526.jpg" alt="enter image description here" title=""></p>

<p>Add this following codes to the module “Module 1” :</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb8a74a1.jpg" alt="enter image description here" title=""></p>

<pre><code>Option Explicit
'   I use AES Rijndael Block Cipher Encryption
Algorithm
Private AES_alog  As CRijndael
Public encryption_key As String


'hexadeimal to String Conversion function
Public Function hexa_to_str(ByVal textData As String)
Dim i As Long, CryptString As String, tmpChar As String
On Local Error Resume Next
For i = 1 To Len(textData) Step 2
CryptString = CryptString &amp; Chr$(Val("&amp;H" &amp; Mid$(textData, i, 2)))
Next i
hexa_to_str = CryptString
End Function

'String to hexadecimal Convertion function
Public Function str_to_hexa(ByVal textData As String)
Dim i As Long, CryptString As String, tmpAppend As String
On Local Error Resume Next
For i = 1 To Len(textData)
    tmpAppend = Hex$(Asc(Mid$(textData, i, 1)))
    If Len(tmpAppend) = 1 Then tmpAppend = Trim$(Str$(0)) &amp; tmpAppend
    CryptString = CryptString &amp; tmpAppend: DoEvents
Next i
str_to_hexa = CryptString
End Function

'Encryption function with AES encryption algorithm
Public Function Encrypt_it(ByVal strMsg As String,
ByVal pKey As String) As String
Dim ByteArray() As Byte, byteKey() As Byte, CryptText() As Byte
On Local Error Resume Next
Set AES_alog = New CRijndael
ByteArray() = StrConv(strMsg, vbFromUnicode)
byteKey() = StrConv(pKey, vbFromUnicode)
CryptText() = AES_alog.EncryptData(ByteArray(), byteKey())
Set AES_alog = Nothing
Encrypt_it = StrConv(CryptText(), vbUnicode)
End Function

'Decryption function with AES encryption algorithm
Public Function Decrypt_it(ByVal strMsg As String,
ByVal pKey As String) As String
Dim ByteArray() As Byte, byteKey() As Byte, CryptText() As Byte
On Local Error Resume Next
Set AES_alog = New CRijndael
ByteArray() = StrConv(strMsg, vbFromUnicode)
byteKey() = StrConv(pKey, vbFromUnicode)
CryptText() = AES_alog.DecryptData(ByteArray(), byteKey())
Set AES_alog = Nothing
Decrypt_it = StrConv(CryptText(), vbUnicode)
End Function
</code></pre>

<p>Input this following code to Form1 :</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb91ae48.jpg" alt="enter image description here" title=""></p>

<pre><code>Private Sub Form_Load()
'don't reveal this key
encryption_key =
"37979fa464f002d8a9bcf743f786863bc090b16864f93a5d1f4b83f9d05" ' you may set your own key
End Sub
'Encrypt data
Private Sub Command1_Click()
Dim sData As String
sData = Text1.Text
sData = Encrypt_it(sData, encryption_key)
Text2.Text = str_to_hexa(sData)
End Sub
Decrypt Data
Private Sub Command2_Click()
Dim sData As String
sData = Trim$(Text1.Text)
sData = hexa_to_str(sData)
Text2.Text = Decrypt_it(sData, encryption_key)
End Sub
</code></pre>

<p>Make the exe file :</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb1081c90.jpg" alt="enter image description here" title=""></p>

<p>Completed ! Now run the exe file :</p>

<p>In this tutorial I’ll encrypt my steemit posting public key <strong>STM6ipnKtY59NESmg7Km5HjUuYzzRHKd8VYdLNXMyHAGUX7MnDWMh</strong> <br>
<img src="https://www.steemimg.com/images/2016/09/16/vb11d045c.jpg" alt="enter image description here" title=""></p>

<p>After encryption I got this encrypted data <strong>873B6CC83B0CBDC2CAC0FA1D94D4A7B9C092A6734EEC85480466DFBADCE7B8F179202D1E25AEA7FE354631E0193860ED2FB4226B162504D258A5E80FE0F5CF9D</strong></p>

<p>You can save this data anywhere without any risk.</p>

<p>Now, I’ll decrypt it again –</p>

<p><img src="https://www.steemimg.com/images/2016/09/16/vb125e411.jpg" alt="enter image description here" title=""></p>

<p>Look that I successfully decrypt it by getting the text again <strong>STM6ipnKtY59NESmg7Km5HjUuYzzRHKd8VYdLNXMyHAGUX7MnDWMh</strong></p>

<p><strong>WARNING !!! I use an encryption key in the code.</strong> </p>

<blockquote>
  <p>‘don’t reveal this key <br>
  encryption_key = “37979fa464f002d8a9bcf743f786863bc090b16864f93a5d1f4b83f9d05” ’ you may set your own key</p>
</blockquote>

<p><strong>This code must be different when you make your own software. And you don’t reveal this key. If anyone gets this encryption key then your encrypted data shall be at risk.</strong></p>

<p><a href="https://drive.google.com/open?id=0BxKS2iCY4L_wQktwbC1ab2IxTms">Download the source code project</a></p>

<a href='https://steempay.io/payment?&receiver=royalmacro&amount=0&currency=0&callback=https://steemit.com/@royalmacro/transfers'>
<img src='https://steempay.io/media/badges/donate/badge_steem-donate--light-v1.4.png'>
</a>

<p>follow me on twitter <img src="https://www.steemimg.com/images/2016/09/14/Twitter-128dbd3a.png" width="128" height="128"/>&nbsp;https://twitter.com/Royalmacro <img src="https://www.steemimg.com/images/2016/09/14/RoyalMacro84299.jpg" width="128" height="129"/></p>
</html>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 3 others
properties (23)
authorroyalmacro
permlinkrepost-to-inform-more-people-about-it-an-open-source-data-encryption-software-for-steemit-users
categoryprogramming
json_metadata{"tags":["programming","encryption","security","steemit","steem"],"image":["https://www.steemimg.com/images/2016/09/16/VB1c3f0e.jpg","https://www.steemimg.com/images/2016/09/16/VB2ce10f.jpg","https://www.steemimg.com/images/2016/09/16/vb386e21.jpg","https://www.steemimg.com/images/2016/09/16/vb454e00.jpg","https://www.steemimg.com/images/2016/09/16/vb5532df.jpg","https://www.steemimg.com/images/2016/09/16/vb66bb27.jpg","https://www.steemimg.com/images/2016/09/16/vb703526.jpg","https://www.steemimg.com/images/2016/09/16/vb8a74a1.jpg","https://www.steemimg.com/images/2016/09/16/vb91ae48.jpg","https://www.steemimg.com/images/2016/09/16/vb1081c90.jpg","https://www.steemimg.com/images/2016/09/16/vb11d045c.jpg","https://www.steemimg.com/images/2016/09/16/vb125e411.jpg","https://steempay.io/media/badges/donate/badge_steem-donate--light-v1.4.png","https://www.steemimg.com/images/2016/09/14/Twitter-128dbd3a.png","https://www.steemimg.com/images/2016/09/14/RoyalMacro84299.jpg"],"links":["https://en.wikipedia.org/wiki/Advanced_Encryption_Standard","https://drive.google.com/open?id=0BxKS2iCY4L_wQktwbC1ab2IxTms","https://steempay.io/payment?&receiver=royalmacro&amount=0&currency=0&callback=https://steemit.com/@royalmacro/transfers","https://twitter.com/Royalmacro"]}
created2016-10-06 06:04:09
last_update2016-10-06 06:04:09
depth0
children7
last_payout2016-11-06 07:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.865 HBD
curator_payout_value0.128 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length29,219
author_reputation181,020,262,458,461
root_title"[repost to inform more people about it] An open source data encryption software for steemit users"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,457,416
net_rshares3,910,023,997,864
author_curate_reward""
vote details (67)
@arnob ·
awesome :D
properties (22)
authorarnob
permlinkre-royalmacro-repost-to-inform-more-people-about-it-an-open-source-data-encryption-software-for-steemit-users-20161006t062216181z
categoryprogramming
json_metadata{"tags":["programming"]}
created2016-10-06 06:22:09
last_update2016-10-06 06:22:09
depth1
children1
last_payout2016-11-06 07:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length10
author_reputation34,520,611,629,153
root_title"[repost to inform more people about it] An open source data encryption software for steemit users"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,457,489
net_rshares0
@royalmacro ·
thank you @arnob
properties (22)
authorroyalmacro
permlinkre-arnob-re-royalmacro-repost-to-inform-more-people-about-it-an-open-source-data-encryption-software-for-steemit-users-20161006t063608341z
categoryprogramming
json_metadata{"tags":["programming"],"users":["arnob"]}
created2016-10-06 06:36:00
last_update2016-10-06 06:36:00
depth2
children0
last_payout2016-11-06 07:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length16
author_reputation181,020,262,458,461
root_title"[repost to inform more people about it] An open source data encryption software for steemit users"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,457,561
net_rshares0
@atkins ·
upvoted
&
resteemed
properties (22)
authoratkins
permlinkre-royalmacro-repost-to-inform-more-people-about-it-an-open-source-data-encryption-software-for-steemit-users-20161006t062933561z
categoryprogramming
json_metadata{"tags":["programming"]}
created2016-10-06 06:29:24
last_update2016-10-06 06:29:24
depth1
children0
last_payout2016-11-06 07:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length19
author_reputation8,678,216,171,659
root_title"[repost to inform more people about it] An open source data encryption software for steemit users"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,457,520
net_rshares0
@jerremie ·
Does it contain only codes or, any executable file exists ?
properties (22)
authorjerremie
permlinkre-royalmacro-repost-to-inform-more-people-about-it-an-open-source-data-encryption-software-for-steemit-users-20161006t062430712z
categoryprogramming
json_metadata{"tags":["programming"]}
created2016-10-06 06:24:24
last_update2016-10-06 06:24:24
depth1
children1
last_payout2016-11-06 07:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length59
author_reputation5,314,569,285,879
root_title"[repost to inform more people about it] An open source data encryption software for steemit users"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,457,496
net_rshares0
@royalmacro ·
both. .... you may scan the url for virus before download.
https://www.virustotal.com/en/url/084b691044538dddd70a246e504caf85eafcd863a26bd53ebe700bd8ea52fdc4/analysis/1475735850/
properties (22)
authorroyalmacro
permlinkre-jerremie-re-royalmacro-repost-to-inform-more-people-about-it-an-open-source-data-encryption-software-for-steemit-users-20161006t063810680z
categoryprogramming
json_metadata{"tags":["programming"],"links":["https://www.virustotal.com/en/url/084b691044538dddd70a246e504caf85eafcd863a26bd53ebe700bd8ea52fdc4/analysis/1475735850/"]}
created2016-10-06 06:38:03
last_update2016-10-06 06:38:03
depth2
children0
last_payout2016-11-06 07:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length178
author_reputation181,020,262,458,461
root_title"[repost to inform more people about it] An open source data encryption software for steemit users"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,457,569
net_rshares0
@nadira ·
great coding :)
properties (22)
authornadira
permlinkre-royalmacro-repost-to-inform-more-people-about-it-an-open-source-data-encryption-software-for-steemit-users-20161006t062722027z
categoryprogramming
json_metadata{"tags":["programming"]}
created2016-10-06 06:27:15
last_update2016-10-06 06:27:15
depth1
children0
last_payout2016-11-06 07:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length15
author_reputation16,131,500,673,289
root_title"[repost to inform more people about it] An open source data encryption software for steemit users"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,457,505
net_rshares0
@shuvo ·
thanks for sharing it
properties (22)
authorshuvo
permlinkre-royalmacro-repost-to-inform-more-people-about-it-an-open-source-data-encryption-software-for-steemit-users-20161006t062553568z
categoryprogramming
json_metadata{"tags":["programming"]}
created2016-10-06 06:25:45
last_update2016-10-06 06:25:45
depth1
children0
last_payout2016-11-06 07:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length21
author_reputation1,619,891,510,905
root_title"[repost to inform more people about it] An open source data encryption software for steemit users"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,457,501
net_rshares0