Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ EncodeSingleOidNum()

static void System.Security.Cryptography.CryptoConfig.EncodeSingleOidNum ( uint value,
byte[] destination,
ref int index )
inlinestaticprivate

Definition at line 402 of file CryptoConfig.cs.

403 {
404 if ((int)value < 128)
405 {
406 if (destination != null)
407 {
408 destination[index++] = (byte)value;
409 }
410 else
411 {
412 index++;
413 }
414 }
415 else if (value < 16384)
416 {
417 if (destination != null)
418 {
419 destination[index++] = (byte)((value >> 7) | 0x80u);
420 destination[index++] = (byte)(value & 0x7Fu);
421 }
422 else
423 {
424 index += 2;
425 }
426 }
427 else if (value < 2097152)
428 {
429 if (destination != null)
430 {
431 destination[index++] = (byte)((value >> 14) | 0x80u);
432 destination[index++] = (byte)((value >> 7) | 0x80u);
433 destination[index++] = (byte)(value & 0x7Fu);
434 }
435 else
436 {
437 index += 3;
438 }
439 }
440 else if (value < 268435456)
441 {
442 if (destination != null)
443 {
444 destination[index++] = (byte)((value >> 21) | 0x80u);
445 destination[index++] = (byte)((value >> 14) | 0x80u);
446 destination[index++] = (byte)((value >> 7) | 0x80u);
447 destination[index++] = (byte)(value & 0x7Fu);
448 }
449 else
450 {
451 index += 4;
452 }
453 }
454 else if (destination != null)
455 {
456 destination[index++] = (byte)((value >> 28) | 0x80u);
457 destination[index++] = (byte)((value >> 21) | 0x80u);
458 destination[index++] = (byte)((value >> 14) | 0x80u);
459 destination[index++] = (byte)((value >> 7) | 0x80u);
460 destination[index++] = (byte)(value & 0x7Fu);
461 }
462 else
463 {
464 index += 5;
465 }
466 }

References System.destination, System.index, and System.value.

Referenced by System.Security.Cryptography.CryptoConfig.EncodeOID().