Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. SELECT 1
  2. FROM dbo.Customers
  3. WHERE CustID = @CustID COLLATE SQL_Latin1_General_CP1_CS_AS
  4. AND CustPassword = @CustPassword COLLATE SQL_Latin1_General_CP1_CS_AS
  5.  
  6. SELECT *
  7. FROM Users
  8. WHERE
  9. Username = @Username COLLATE SQL_Latin1_General_CP1_CS_AS
  10. AND Password = @Password COLLATE SQL_Latin1_General_CP1_CS_AS
  11. AND Username = @Username
  12. AND Password = @Password
  13.  
  14. SELECT *
  15. FROM Users
  16. WHERE
  17. CAST(Username as varbinary(100)) = CAST(@Username as varbinary))
  18. AND CAST(Password as varbinary(100)) = CAST(@Password as varbinary(100))
  19. AND Username = @Username
  20. AND Password = @Password
  21.  
  22. Select * from your_table where convert(varbinary, your_column) = convert(varbinary, 'aBcD')
  23.  
  24. SELECT
  25. FROM Users
  26. WHERE
  27. BINARY_CHECKSUM(Username) = BINARY_CHECKSUM(@Username)
  28. AND BINARY_CHECKSUM(Password) = BINARY_CHECKSUM(@Password)
  29.  
  30. declare @first_value nvarchar(1) = 'a'
  31. declare @second_value navarchar(1) = 'A'
  32.  
  33. if HASHBYTES('SHA1',@first_value) = HASHBYTES('SHA1',@second_value) begin
  34. print 'equal'
  35. end else begin
  36. print 'not equal'
  37. end
  38.  
  39. -- output:
  40. -- not equal
  41.  
  42. declare @example table (ValueA nvarchar(1), ValueB nvarchar(1))
  43.  
  44. insert into @example (ValueA, ValueB)
  45. values ('a', 'A'),
  46. ('a', 'a'),
  47. ('a', 'b')
  48.  
  49. select ValueA + ' = ' + ValueB
  50. from @example
  51. where hashbytes('SHA1', ValueA) = hashbytes('SHA1', ValueB)
  52.  
  53. -- output:
  54. -- a = a
  55.  
  56. select ValueA + ' <> ' + ValueB
  57. from @example
  58. where hashbytes('SHA1', ValueA) <> hashbytes('SHA1', ValueB)
  59.  
  60. -- output:
  61. -- a <> A
  62. -- a <> b
  63.  
  64. declare @value_b nvarchar(1) = 'A'
  65.  
  66. select ValueB + ' = ' + @value_b
  67. from @example
  68. where hashbytes('SHA1', ValueB) = hasbytes('SHA1', @value_b)
  69.  
  70. -- output:
  71. -- A = A
  72.  
  73. SELECT * FROM table_name WHERE binary username=@search_parameter and binary password=@search_parameter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement