File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -48,3 +48,45 @@ CREATE OPERATOR CLASS eql_v2.encrypted_operator DEFAULT FOR TYPE eql_v2_encrypte
48
48
OPERATOR 5 > ,
49
49
FUNCTION 1 eql_v2 .compare (a eql_v2_encrypted, b eql_v2_encrypted);
50
50
51
+
52
+ -- ------------------
53
+
54
+
55
+ CREATE FUNCTION eql_v2 .compare_hmac(a eql_v2_encrypted, b eql_v2_encrypted)
56
+ RETURNS integer
57
+ IMMUTABLE STRICT PARALLEL SAFE
58
+ AS $$
59
+ DECLARE
60
+ a_hmac eql_v2 .hmac_256 ;
61
+ b_hmac eql_v2 .hmac_256 ;
62
+ BEGIN
63
+
64
+ a_hmac = eql_v2 .hmac_256 (a);
65
+ b_hmac = eql_v2 .hmac_256 (b);
66
+
67
+ IF a_hmac = b_hmac THEN
68
+ RETURN 0 ;
69
+ END IF;
70
+
71
+ IF a_hmac < b_hmac THEN
72
+ RETURN - 1 ;
73
+ END IF;
74
+
75
+ IF a_hmac > b_hmac THEN
76
+ RETURN 1 ;
77
+ END IF;
78
+
79
+ END;
80
+ $$ LANGUAGE plpgsql;
81
+
82
+
83
+ CREATE OPERATOR FAMILY eql_v2 .encrypted_hmac_256_operator USING btree;
84
+
85
+ CREATE OPERATOR CLASS eql_v2 .encrypted_hmac_256_operator FOR TYPE eql_v2_encrypted USING btree FAMILY eql_v2 .encrypted_hmac_256_operator AS
86
+ OPERATOR 1 < ,
87
+ OPERATOR 2 <= ,
88
+ OPERATOR 3 = ,
89
+ OPERATOR 4 >= ,
90
+ OPERATOR 5 > ,
91
+ FUNCTION 1 eql_v2 .compare_hmac (a eql_v2_encrypted, b eql_v2_encrypted);
92
+
You can’t perform that action at this time.
0 commit comments