Showing posts with label encryption. Show all posts
Showing posts with label encryption. Show all posts

Friday, 1 March 2019

Set Up Hidden Parameter in Address Bar asp.net



Image result for math

Been looking for a way to encode the parameters in you address bar so every one can not see them?
I was there are lots of ways but i like simple and the application din not need to be that secure.

This is what i came up with

dim myid as int

myid =789456*210    ' this will go into the URL as 1658160


When the target page loads simple add in the load event

dim my as int

myint =  CInt(Request.QueryString("Datastring").ToString) \250

myint = 789456



Monday, 19 March 2018

Data encrytion code VB,net Tsql


Found this knocking around the next and it works well if you need some encryption.
Create the following function in tsql


 
/****** Object: UserDefinedFunction [dbo].[fnEncDecRc4] Script Date: 03/19/2018 12:31:40 ******/

SET ANSI_NULLS ON


GO
SET QUOTED_IDENTIFIER ON


GO
ALTER FUNCTION [dbo].[fnEncDecRc4]


(
@Pwd VARCHAR(256),

@Text VARCHAR(8000)


)
RETURNS VARCHAR(8000)


AS

BEGIN
DECLARE @Box TABLE (i TINYINT, v TINYINT)

INSERT @Box

(

i,

v

)

SELECT i,

v

FROM dbo.fnInitRc4(@Pwd)

DECLARE @Index SMALLINT,

@i SMALLINT,

@j SMALLINT,

@t TINYINT,

@k SMALLINT,

@CipherBy TINYINT,

@Cipher VARCHAR(8000)

SELECT @Index = 1,

@i = 0,

@j = 0,

@Cipher = ''

WHILE @Index <= DATALENGTH(@Text)

BEGIN

SELECT @i = (@i + 1) % 256

SELECT @j = (@j + b.v) % 256

FROM @Box b

WHERE b.i = @i

SELECT @t = v

FROM @Box

WHERE i = @i

UPDATE b

SET b.v = (SELECT w.v FROM @Box w WHERE w.i = @j)

FROM @Box b

WHERE b.i = @i

UPDATE @Box

SET v = @t

WHERE i = @j

SELECT @k = v

FROM @Box

WHERE i = @i

SELECT @k = (@k + v) % 256

FROM @Box

WHERE i = @j

SELECT @k = v

FROM @Box

WHERE i = @k

SELECT @CipherBy = ASCII(SUBSTRING(@Text, @Index, 1)) ^ @k,

@Cipher = @Cipher + CHAR(@CipherBy)

SELECT @Index = @Index +1

END

RETURN @Cipher


END


Then use the following to call it this is VB.net.
first call sets the encryption

select database name.dbo.fnEncDecRc4('encryption key','OrderID')



second call decodes.
select database name.dbo.fnEncDecRc4('encryption key','OrderID')

I have used this to encrypt passwords in tables  and to pass query parameters in the address bar  of web pages.





 

Multi Point USB Charger

  USB Plug Charger, 4-Port USB Fast Charger Plug with 33W Intelligent Quick Charge 3.0 Wall Charger, Multi USBPower Adapter UK Fast Charging...