Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/asn1crypto/_int.py: 33%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

6 statements  

1# coding: utf-8 

2from __future__ import unicode_literals, division, absolute_import, print_function 

3 

4 

5def fill_width(bytes_, width): 

6 """ 

7 Ensure a byte string representing a positive integer is a specific width 

8 (in bytes) 

9 

10 :param bytes_: 

11 The integer byte string 

12 

13 :param width: 

14 The desired width as an integer 

15 

16 :return: 

17 A byte string of the width specified 

18 """ 

19 

20 while len(bytes_) < width: 

21 bytes_ = b'\x00' + bytes_ 

22 return bytes_