Пример #1
0
        public static byte[] GetNameSKeySubject(string name, string subject)
        {
            var nameBytes = KeyConfig.GetBytes(name);
            var z         = KeyConfig.ByteZero;
            var sBytes    = KeyConfig.GetBytes(subject);

            return(KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteS, z, sBytes));
        }
Пример #2
0
        public static byte[] GetNamePKeyPredicate(string name, string predicate)
        {
            var nameBytes = KeyConfig.GetBytes(name);
            var z         = KeyConfig.ByteZero;
            var pBytes    = KeyConfig.GetBytes(predicate);

            return(KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteP, z, pBytes));
        }
Пример #3
0
        public static byte[] GetNameOKeyObject(string name, TripleObject o)
        {
            var nameBytes = KeyConfig.GetBytes(name);
            var z         = KeyConfig.ByteZero;
            var oBytes    = KeyConfig.GetBytes(o.ToValue());
            var isIdBytes = o.IsID ? KeyConfig.ByteTrue : KeyConfig.ByteFalse;

            return(KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteO, z, isIdBytes, z, oBytes));
        }
Пример #4
0
 public KeySegments(string name, string s, string p, TripleObject o)
 {
     _name = KeyConfig.GetBytes(name);
     S     = KeyConfig.GetBytes(s);
     P     = KeyConfig.GetBytes(p);
     O     = KeyConfig.GetBytes(o.ToValue());
     IsId  = o.IsID ? KeyConfig.ByteTrue : KeyConfig.ByteFalse;
     Index = BitConverter.GetBytes(o.Index);
 }
Пример #5
0
        public static byte[] ToBytes(this TripleObject o)
        {
            var oBytes    = KeyConfig.GetBytes(o.ToValue());
            var isIdBytes = o.IsID ? KeyConfig.ByteTrue : KeyConfig.ByteFalse;
            var typeBytes = KeyConfig.GetBytes((int)o.TokenType);

            // index is not converted
            return(KeyConfig.ConcatBytes(isIdBytes, typeBytes, oBytes));
        }
Пример #6
0
        public static byte[] GetNameSKeySubjectPredicateIndex(string name, string subject, string predicate, int index)
        {
            var nameBytes  = KeyConfig.GetBytes(name);
            var z          = KeyConfig.ByteZero;
            var sBytes     = KeyConfig.GetBytes(subject);
            var pBytes     = KeyConfig.GetBytes(predicate);
            var indexBytes = BitConverter.GetBytes(index);

            return(KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteS, z, sBytes, z, pBytes, z, indexBytes));
        }
Пример #7
0
 public static byte[] GetNameSKey(string name)
 {
     return(KeyConfig.ConcatBytes(KeyConfig.GetBytes(name), KeyConfig.ByteS));
 }
Пример #8
0
        public static byte[] GetNamePPredicate(string name)
        {
            var nameBytes = KeyConfig.GetBytes(name);

            return(KeyConfig.ConcatBytes(nameBytes, KeyConfig.ByteP));
        }
Пример #9
0
 private byte[] Hash(string input)
 {
     return(KeyConfig.GetBytes(input));
 }