|
| Author |
Message |
Klev
Joined: 04 Oct 2007 Posts: 2
|
Posted: Fri Sep 05, 2003 9:10 am Post subject: Encrypting a text file |
|
|
I am trying to encrypt the data sent to a text file. How do I do this and
how do I unencrypt it?
Or can someone point me in the right direction.
Any help would be welcome.
Archived from group: microsoft>public>vb>controls>creation |
|
| Back to top |
|
 |
Eduardo A. Morcillo [MS M
Joined: 04 Oct 2007 Posts: 85
|
Posted: Fri Sep 05, 2003 4:26 am Post subject: Re: Encrypting a text file |
|
|
> I am trying to encrypt the data sent to a text file. How do I do this
> and how do I unencrypt it?
It depends on how secure you want it to be. The following page contains two
functions which use CryptoAPI to encrypt/decrypt data:
Encrypting data with CryptoAPI
http://www.mvps.org/emorcillo/cod/tips/cryptoapi/encrypt.htm
--
Eduardo A. Morcillo [MS MVP]
http://www.mvps.org/emorcillo |
|
| Back to top |
|
 |
Klev
Joined: 04 Oct 2007 Posts: 2
|
Posted: Fri Sep 05, 2003 10:34 am Post subject: Re: Encrypting a text file |
|
|
Eduardo
Is the API freely distributable and how do I get hold of it or is it part of
VB?
Thanks
"Eduardo A. Morcillo [MS MVP]" wrote in message@TK2MSFTNGP11.phx.gbl...
> > I am trying to encrypt the data sent to a text file. How do I do this
> > and how do I unencrypt it?
>
> It depends on how secure you want it to be. The following page contains
two
> functions which use CryptoAPI to encrypt/decrypt data:
>
> Encrypting data with CryptoAPI
> http://www.mvps.org/emorcillo/cod/tips/cryptoapi/encrypt.htm
>
> --
> Eduardo A. Morcillo [MS MVP]
> http://www.mvps.org/emorcillo
>
> |
|
| Back to top |
|
 |
Eduardo A. Morcillo [MS M
Joined: 04 Oct 2007 Posts: 85
|
Posted: Fri Sep 05, 2003 2:01 pm Post subject: Re: Encrypting a text file |
|
|
> Is the API freely distributable and how do I get hold of it or is it
> part of VB?
CryptoAPI is part of the operating system. You don't have to distribute it.
--
Eduardo A. Morcillo [MS MVP]
http://www.mvps.org/emorcillo |
|
| Back to top |
|
 |
Douglas Marquardt
Joined: 04 Oct 2007 Posts: 157
|
Posted: Fri Sep 05, 2003 1:49 pm Post subject: Re: Encrypting a text file |
|
|
Well... that is the case for newer versions of Windows.
For older versions (Win98, Win NT) you need to ensure that
the users have IE version 3.2 or later with the high encryption pack.
Doug.
"Eduardo A. Morcillo [MS MVP]" wrote in message @TK2MSFTNGP10.phx.gbl...
> > Is the API freely distributable and how do I get hold of it or is it
> > part of VB?
>
> CryptoAPI is part of the operating system. You don't have to distribute it.
>
> --
> Eduardo A. Morcillo [MS MVP]
> http://www.mvps.org/emorcillo
>
> |
|
| Back to top |
|
 |
Simon Roberts
Joined: 04 Oct 2007 Posts: 2
|
Posted: Mon Sep 08, 2003 2:51 am Post subject: Re: Encrypting a text file |
|
|
"Klev" wrote in
@TK2MSFTNGP09.phx.gbl:
> I am trying to encrypt the data sent to a text file. How do I do this and
> how do I unencrypt it?
>
> Or can someone point me in the right direction.
>
> Any help would be welcome.
>
>
You welcome to use my NRG encryption algorthim if you like it is 256bit and
works a bit like a spring. It is based on 5000 year old mathamatics and is
very hard to crack.
the source code for it is available from http://www.ep.net.au/ant/main.htm
If you change any of the variables it is next to impossible even with the
source code to break.
-psyhkal- |
|
| Back to top |
|
 |
Ben Taylor
Joined: 04 Oct 2007 Posts: 67
|
Posted: Tue Sep 09, 2003 6:05 am Post subject: Re: Encrypting a text file |
|
|
In case all the other replies were useless, here's a
simple XOR encryption function that you don't have to
license or install additional DLLs. It's the same function
to decrypt as to encrypt, you just have to supply the same
key. The longer the key, the harder it is to crack.
Sub EncryptFile(OldFilePath As String, NewFilePath As
String, Key As String)
Dim ff1 As Long, ff2 As Long
Dim OldBytes() As Byte
Dim NewBytes() As Byte
Dim CurByte As Long, TotBytes As Long
TotBytes = FileLen(OldFilePath)
ReDim OldBytes(1 To TotBytes)
ReDim NewBytes(1 To TotBytes)
Dim KeyLength As Long
Dim KeyPos As Long
If Dir(OldFilePath) = "" Then Exit Sub
KeyLength = Len(Key)
ff1 = FreeFile
Open OldFilePath For Binary Access Read As #ff1
ff2 = FreeFile
Open NewFilePath For Binary Access Write As #ff2
Get #ff1, , OldBytes
For CurByte = 1 To TotBytes
KeyPos = KeyLength + 1 - CurByte + KeyLength *
((CurByte - 1) \ KeyLength)
NewBytes(CurByte) = OldBytes(CurByte) Xor Asc
(Mid$(Key, KeyPos, 1))
Next
Put #ff2, , NewBytes
Close #ff1
Close #ff2
End Sub
Function GetRandomString(StringLength As Long) As String
Static bRandomized As Boolean
If Not bRandomized Then Randomize Timer
GetRandomString = Space(StringLength) 'which will
initially put the string at somewhere
'in memory large enough to hold it all
Dim lgChar As Long
For lgChar = 1 To StringLength
Mid$(GetRandomString, lgChar, 1) = Chr$(Int(255 *
Rnd()))
Next
End Function
>-----Original Message-----
>I am trying to encrypt the data sent to a text file. How
do I do this and
>how do I unencrypt it?
>
>Or can someone point me in the right direction.
>
>Any help would be welcome.
>
>
>.
>
|
|
| Back to top |
|
 |
|