Encrypt Simple String

Hi All,

I Need to Encrypt simple string and later i need to decrypt the earlier encrypted string back to normal string. ohhh.. i forgot to tell after Encrypt the string I'm Storing it in a text file.


Plz Can some one help me.......


Wish you a very happy new year and happy Xmas to all of you !!!!!

Best Regards,

Comments

  • Hi,

    The .Net class library has some built in encryption classes.

    http://msdn2.microsoft.com/en-us/library/system.security.cryptography(VS.80).aspx

    So you can use those to do the encryption itself (whatever you do, don't write your own home grown encryption routine; it will be insecure, unless you're a Math PhD, in which case you probably wouldn't be posting asking how to do encryption ;-)). The choice of which algorithm to go with from the .Net class library largely depends on what you're wanting to achieve, though I suspect you'll want a symmetric one, such as Triple DES.

    You can write it to a file the normal way, using the routines from System.IO.

    Hope this gives you a start,

    Jonathan
    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
  • Thank you very much for the information. i got simple method to do encryption.

    [code] Public Function SimpleCrypt( _
    ByVal Text As String) As String
    ' Encrypts/decrypts the passed string using
    ' a simple ASCII value-swapping algorithm
    Dim strTempChar As String, i As Integer
    For i = 1 To Len(Text)
    If Asc(Mid$(Text, i, 1)) < 128 Then
    strTempChar = _
    CType(Asc(Mid$(Text, i, 1)) + 128, String)
    ElseIf Asc(Mid$(Text, i, 1)) > 128 Then
    strTempChar = _
    CType(Asc(Mid$(Text, i, 1)) - 128, String)
    End If
    Mid$(Text, i, 1) = _
    Chr(CType(strTempChar, Integer))
    Next i
    Return Text
    End Function[/code]

    This is more than enough for me. but there was a another problem. As i told I stored encrypted string in a text file(Manually).

    And in different component try to read by using Stream Reader. but it did not return any thing. I know my program reading the file. but this encrypted text is not retrieving properly. Please can some one help me.

    Best Regards,

    : Hi,
    :
    : The .Net class library has some built in encryption classes.
    :
    : http://msdn2.microsoft.com/en-us/library/system.security.cryptography
    : (VS.80).aspx
    :
    : So you can use those to do the encryption itself (whatever you do,
    : don't write your own home grown encryption routine; it will be
    : insecure, unless you're a Math PhD, in which case you probably
    : wouldn't be posting asking how to do encryption ;-)). The choice of
    : which algorithm to go with from the .Net class library largely
    : depends on what you're wanting to achieve, though I suspect you'll
    : want a symmetric one, such as Triple DES.
    :
    : You can write it to a file the normal way, using the routines from
    : System.IO.
    :
    : Hope this gives you a start,
    :
    : Jonathan
    : ###
    : for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    : (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    : /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories